perf/core: Allow list_del during perf_event_overflow()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
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().
From the CVE record · Linux
The Linux kernel perf/core scheduler callback can corrupt a list if a PMU removes an entry while the list is being traversed. This can occur after a local caller invokes PERF_EVENT_IOC_REFRESH and the perf event limit reaches zero; the input does not specify authentication requirements.
Engineers running Linux kernels with the affected perf/core code should check their kernel; affected versions are not specified.