Skip to content

Commit c95eb31

Browse files
wildea01Russell King
authored andcommitted
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: <[email protected]> Reported-by: Vince Weaver <[email protected]> Tested-by: Vince Weaver <[email protected]> Tested-by: Mark Rutland <[email protected]> Signed-off-by: Will Deacon <[email protected]> Signed-off-by: Russell King <[email protected]>
1 parent 2ba85e7 commit c95eb31

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/arm/kernel/perf_event.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ validate_event(struct pmu_hw_events *hw_events,
253253
struct arm_pmu *armpmu = to_arm_pmu(event->pmu);
254254
struct pmu *leader_pmu = event->group_leader->pmu;
255255

256+
if (is_software_event(event))
257+
return 1;
258+
256259
if (event->pmu != leader_pmu || event->state < PERF_EVENT_STATE_OFF)
257260
return 1;
258261

0 commit comments

Comments
 (0)