diff options
| author | Thomas Richter <tmricht@linux.ibm.com> | 2026-09-08 12:56:37 +0200 |
|---|---|---|
| committer | Peter Zijlstra <peterz@infradead.org> | 2026-09-10 10:22:50 +0200 |
| commit | 59e63416f5153e7d58652c616fbdcb7d5e01fff7 (patch) | |
| tree | 33f37a5a5c86a8b200642bf8ef383ff7a89b9b61 /scripts/basic/split-include.c | |
| parent | df2908090cda368b01ff43709f51890076c56157 (diff) | |
| download | linux-stable-59e63416f5153e7d58652c616fbdcb7d5e01fff7.tar.gz linux-stable-59e63416f5153e7d58652c616fbdcb7d5e01fff7.zip | |
perf/core: Allow list_del during perf_event_overflow()
A PMU might use perf_sched_cb_inc() and perf_sched_cb_dec()
interface to get the PMU call back function pmu::sched_task
invoked at schedule in and schedule out. This is achieved
by walking along the list anchored by sched_cb_list.
The following scenario might lead to a list corruption.
perf_pmu_sched_task()
for_each_list_entry(..., &sched_cb_list)
+--> __perf_pmu_sched_task()
+--> event->pmu->sched_task())
+--> PMU_push_sample()
+--> perf_event_overflow()
+--> __perf_event_overflow()
+--> pmu->stop()
+--> perf_sched_cb_dec()
remove entry from sched_cb_list
while list node in use.
This happens when ioctl(fd, PERF_EVENT_IOC_REFRESH, xxx) has been
invoked and perf_event::event_limit hits zero.
Prevent the list corruption and convert for_each_list_entry()
to for_each_list_entry_safe().
Fixes: bd2756811766 ("perf: Rewrite core context handling")
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://patch.msgid.link/20260908105637.627004-1-tmricht@linux.ibm.com
Diffstat (limited to 'scripts/basic/split-include.c')
0 files changed, 0 insertions, 0 deletions
