mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] perf/x86/intel: Annotate x86_pmu::hybrid_pmu with __counted_by_ptr
@ 2026-09-04 14:17 Thorsten Blum
  2026-09-04 15:47 ` Ian Rogers
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-09-04 14:17 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Adrian Hunter, James Clark, Thomas Gleixner,
	Borislav Petkov, Dave Hansen, x86, H. Peter Anvin, Kees Cook,
	Gustavo A. R. Silva
  Cc: Thorsten Blum, linux-perf-users, linux-kernel, linux-hardening

Add __counted_by_ptr() to x86_pmu::hybrid_pmu to improve access bounds
checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE.

Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 arch/x86/events/perf_event.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h
index 71ed5b2acea2..b66691a4fc31 100644
--- a/arch/x86/events/perf_event.h
+++ b/arch/x86/events/perf_event.h
@@ -1050,7 +1050,7 @@ struct x86_pmu {
 	 * unique capabilities.
 	 */
 	int				num_hybrid_pmus;
-	struct x86_hybrid_pmu		*hybrid_pmu;
+	struct x86_hybrid_pmu		*hybrid_pmu __counted_by_ptr(num_hybrid_pmus);
 	enum intel_cpu_type (*get_hybrid_cpu_type)	(void);
 };
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] perf/x86/intel: Annotate x86_pmu::hybrid_pmu with __counted_by_ptr
  2026-09-04 14:17 [PATCH] perf/x86/intel: Annotate x86_pmu::hybrid_pmu with __counted_by_ptr Thorsten Blum
@ 2026-09-04 15:47 ` Ian Rogers
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Rogers @ 2026-09-04 15:47 UTC (permalink / raw)
  To: Thorsten Blum, Dapeng Mi
  Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Adrian Hunter, James Clark, Thomas Gleixner, Borislav Petkov,
	Dave Hansen, x86, H. Peter Anvin, Kees Cook, Gustavo A. R. Silva,
	linux-perf-users, linux-kernel, linux-hardening

On Fri, Sep 4, 2026 at 7:17 AM Thorsten Blum <blum@kernel.org> wrote:
>
> Add __counted_by_ptr() to x86_pmu::hybrid_pmu to improve access bounds
> checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE.
>
> Signed-off-by: Thorsten Blum <blum@kernel.org>
> ---
>  arch/x86/events/perf_event.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/events/perf_event.h b/arch/x86/events/perf_event.h
> index 71ed5b2acea2..b66691a4fc31 100644
> --- a/arch/x86/events/perf_event.h
> +++ b/arch/x86/events/perf_event.h
> @@ -1050,7 +1050,7 @@ struct x86_pmu {
>          * unique capabilities.
>          */
>         int                             num_hybrid_pmus;
> -       struct x86_hybrid_pmu           *hybrid_pmu;
> +       struct x86_hybrid_pmu           *hybrid_pmu __counted_by_ptr(num_hybrid_pmus);

Reviewed-by: Ian Rogers <irogers@google.com>

Thanks,
Ian

>         enum intel_cpu_type (*get_hybrid_cpu_type)      (void);
>  };
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-04 15:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-04 14:17 [PATCH] perf/x86/intel: Annotate x86_pmu::hybrid_pmu with __counted_by_ptr Thorsten Blum
2026-09-04 15:47 ` Ian Rogers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®