summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorWill Deacon <will.deacon@arm.com>2013-08-07 23:39:41 +0100
committerKe Qinghua <qinghua.ke@freescale.com>2014-03-07 16:18:26 +0800
commit6e1f98cbd2f20ff36e0879f0d5422fb18d707e89 (patch)
tree3c956b8978832d482eb74570e2faf5281df07b97 /arch
parent1897f80aec684dc8a8e5a8fde5c9d74feaf90638 (diff)
ARM: 7809/1: perf: fix event validation for software group leaders
It is possible to construct an event group with a software event as a group leader and then subsequently add a hardware event to the group. This results in the event group being validated by adding all members of the group to a fake PMU and attempting to allocate each event on their respective PMU. Unfortunately, for software events wthout a corresponding arm_pmu, this results in a kernel crash attempting to dereference the ->get_event_idx function pointer. This patch fixes the problem by checking explicitly for software events and ignoring those in event validation (since they can always be scheduled). We will probably want to revisit this for 3.12, since the validation checks don't appear to work correctly when dealing with multiple hardware PMUs anyway. Cc: <stable@vger.kernel.org> Reported-by: Vince Weaver <vincent.weaver@maine.edu> Tested-by: Vince Weaver <vincent.weaver@maine.edu> Tested-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Conflicts: arch/arm/kernel/perf_event.c
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/kernel/perf_event.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index e69de2406759..0acd08e367cc 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -359,6 +359,9 @@ validate_event(struct cpu_hw_events *cpuc,
{
struct hw_perf_event fake_event = event->hw;
+ if (is_software_event(event))
+ return 1;
+
if (event->pmu != &pmu || event->state <= PERF_EVENT_STATE_OFF)
return 1;