perf: Fix hang while freeing sigtrap event
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 3a5465418f5fd970e86a86c7f4075be262682840 · < 56799bc035658738f362acec3e7647bb84e68933| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
perf: Fix hang while freeing sigtrap event
Perf can hang while freeing a sigtrap event if a related deferred signal hadn't managed to be sent before the file got closed:
perf_event_overflow() task_work_add(perf_pending_task)
fput() task_work_add(____fput())
task_work_run() ____fput() perf_release() perf_event_release_kernel() _free_event() perf_pending_task_sync() task_work_cancel() -> FAILED rcuwait_wait_event()
Once task_work_run() is running, the list of pending callbacks is removed from the task_struct and from this point on task_work_cancel() can't remove any pending and not yet started work items, hence the task_work_cancel() failure and the hang on rcuwait_wait_event().
Task work could be changed to remove one work at a time, so a work running on the current task can always cancel a pending one, however the wait / wake design is still subject to inverted dependencies when remote targets are involved, as pictured by Oleg:
From the CVE record · Linux
The Linux kernel perf subsystem can hang while freeing a sigtrap event if its deferred signal has not been sent before the event file is closed. This occurs during perf event cleanup; the input does not specify authentication requirements or any separate user interaction.
Engineers running the Linux kernel should check their deployments; affected versions are not specified in the input.