perf/x86/intel: Annotate x86_pmu::hybrid_pmu with __counted_by_ptr
Subsystems (2)
PATCH 1/1 perf/x86/intel: Annotate x86_pmu::hybrid_pmu with __counted_by_ptr
Add __counted_by_ptr() to x86_pmu::hybrid_pmu to improve access bounds checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE.
--- arch/x86/events/perf_event.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/perf_event.h +1 -1
@@ -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 ); };
[email protected]
AI reviewSashiko has reviewed this patch and found no issues. It looks great!
Quoted 4 lines
Add
__counted_by_ptr()tox86_pmu::hybrid_pmuto improve access bounds checking viaCONFIG_UBSAN_BOUNDSandCONFIG_FORTIFY_SOURCE.Signed-off-by Thorsten Blum <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Quoted 14 lines · Thorsten Blum
Add
__counted_by_ptr()tox86_pmu::hybrid_pmuto improve access bounds checking viaCONFIG_UBSAN_BOUNDSandCONFIG_FORTIFY_SOURCE.Signed-off-by Thorsten Blum <[email protected]>--- arch/x86/events/perf_event.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/events/perf_event.h +0
-0
arch/x86/events/perf_event.h struct x86_pmu { · line 1053
Quoted 5 lines
arch/x86/events/perf_event.h +1
-1@@ -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);
Thanks,
Ian
Quoted 3 lines
arch/x86/events/perf_event.h +0
-0enum intel_cpu_type (*get_hybrid_cpu_type) (void ); };
Mi, Dapeng
Reviewed-byThanks.
Quoted 27 lines · Ian Rogers
Quoted 13 lines · Thorsten Blum
Add
__counted_by_ptr()tox86_pmu::hybrid_pmuto improve access bounds checking viaCONFIG_UBSAN_BOUNDSandCONFIG_FORTIFY_SOURCE.Signed-off-by Thorsten Blum <[email protected]>--- arch/x86/events/perf_event.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/events/perf_event.h +0
-0arch/x86/events/perf_event.h struct x86_pmu { · line 1053
Quoted 5 lines
arch/x86/events/perf_event.h +1
-1@@ -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 <[email protected]>Thanks,
IanQuoted 3 lines
arch/x86/events/perf_event.h +0
-0enum intel_cpu_type (*get_hybrid_cpu_type) (void ); };
The following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 52a6457f59adf70d624ef1b1bed8d55cb7b73af6 Gitweb: https://git.kernel.org/tip/52a6457f59adf70d624ef1b1bed8d55cb7b73af6 Author: Thorsten Blum <[email protected]> AuthorDate: Fri, 04 Sep 2026 16:17:00 +02:00 Committer: Peter Zijlstra <[email protected]> CommitterDate: Fri, 25 Sep 2026 12:45:52 +02:00
perf/x86/intel: Annotate x86_pmu::hybrid_pmu with __counted_by_ptr
Add __counted_by_ptr() to x86_pmu::hybrid_pmu to improve access bounds checking via CONFIG_UBSAN_BOUNDS and CONFIG_FORTIFY_SOURCE.
--- arch/x86/events/perf_event.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/events/perf_event.h +1 -1
@@ -1245,7 +1245,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 ); };