Commit 4b9ce67
Peter Zijlstra
perf: Make sure to use pmu_ctx->pmu for groups
Oliver reported that x86_pmu_del() ended up doing an out-of-bound memory access
when group_sched_in() fails and needs to roll back.
This *should* be handled by the transaction callbacks, but he found that when
the group leader is a software event, the transaction handlers of the wrong PMU
are used. Despite the move_group case in perf_event_open() and group_sched_in()
using pmu_ctx->pmu.
Turns out, inherit uses event->pmu to clone the events, effectively undoing the
move_group case for all inherited contexts. Fix this by also making inherit use
pmu_ctx->pmu, ensuring all inherited counters end up in the same pmu context.
Similarly, __perf_event_read() should use equally use pmu_ctx->pmu for the
group case.
Fixes: bd27568 ("perf: Rewrite core context handling")
Reported-by: Oliver Rosenberg <olrose55@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Ian Rogers <irogers@google.com>
Link: https://patch.msgid.link/20260309133713.GB606826@noisy.programming.kicks-ass.net1 parent f1cac6a commit 4b9ce67
1 file changed
Lines changed: 8 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4813 | 4813 | | |
4814 | 4814 | | |
4815 | 4815 | | |
4816 | | - | |
| 4816 | + | |
4817 | 4817 | | |
4818 | 4818 | | |
4819 | 4819 | | |
| |||
4825 | 4825 | | |
4826 | 4826 | | |
4827 | 4827 | | |
4828 | | - | |
| 4828 | + | |
4829 | 4829 | | |
4830 | 4830 | | |
4831 | 4831 | | |
4832 | 4832 | | |
4833 | 4833 | | |
4834 | 4834 | | |
4835 | 4835 | | |
4836 | | - | |
| 4836 | + | |
4837 | 4837 | | |
4838 | 4838 | | |
4839 | | - | |
| 4839 | + | |
4840 | 4840 | | |
4841 | | - | |
| 4841 | + | |
4842 | 4842 | | |
4843 | 4843 | | |
| 4844 | + | |
4844 | 4845 | | |
4845 | 4846 | | |
4846 | | - | |
4847 | | - | |
| 4847 | + | |
4848 | 4848 | | |
4849 | 4849 | | |
4850 | 4850 | | |
4851 | 4851 | | |
4852 | | - | |
4853 | | - | |
4854 | | - | |
4855 | 4852 | | |
4856 | 4853 | | |
4857 | 4854 | | |
| |||
14744 | 14741 | | |
14745 | 14742 | | |
14746 | 14743 | | |
14747 | | - | |
| 14744 | + | |
14748 | 14745 | | |
14749 | 14746 | | |
14750 | 14747 | | |
| |||
0 commit comments