Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

perf/x86: Fix potential bad container_of in intel_pmu_hw_config

Auto counter reload may have a group of events with software events
present within it. The software event PMU isn't the x86_hybrid_pmu and
a container_of operation in intel_pmu_set_acr_caused_constr (via the
hybrid helper) could cause out of bound memory reads. Avoid this by
guarding the call to intel_pmu_set_acr_caused_constr with an
is_x86_event check.

Fixes: ec980e4facef ("perf/x86/intel: Support auto counter reload")
Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Thomas Falcon <thomas.falcon@intel.com>
Link: https://patch.msgid.link/20260312194305.1834035-1-irogers@google.com

authored by

Ian Rogers and committed by
Peter Zijlstra
dbde07f0 7aaa8047

+4 -2
+4 -2
arch/x86/events/intel/core.c
··· 4855 4855 intel_pmu_set_acr_caused_constr(leader, idx++, cause_mask); 4856 4856 4857 4857 if (leader->nr_siblings) { 4858 - for_each_sibling_event(sibling, leader) 4859 - intel_pmu_set_acr_caused_constr(sibling, idx++, cause_mask); 4858 + for_each_sibling_event(sibling, leader) { 4859 + if (is_x86_event(sibling)) 4860 + intel_pmu_set_acr_caused_constr(sibling, idx++, cause_mask); 4861 + } 4860 4862 } 4861 4863 4862 4864 if (leader != event)