CVE-2025-37747: perf: Fix hang while freeing sigtrap event
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:
perfeventoverflow() taskworkadd(perfpendingtask)
fput() taskworkadd(fput())
taskworkrun() fput() perfrelease() perfeventreleasekernel() freeevent() perfpendingtasksync() taskworkcancel() -> FAILED rcuwaitwaitevent()
Once taskworkrun() is running, the list of pending callbacks is removed from the taskstruct and from this point on taskworkcancel() can't remove any pending and not yet started work items, hence the taskworkcancel() failure and the hang on rcuwaitwaitevent().
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:
T1 T2
fd = perfeventopen(pid => T2->pid); fd = perfeventopen(pid => T1->pid); close(fd) close(fd) <IRQ> <IRQ> perfeventoverflow() perfeventoverflow() taskworkadd(perfpendingtask) taskworkadd(perfpendingtask) </IRQ> </IRQ> fput() fput() taskworkadd(fput()) taskworkadd(fput())
taskworkrun() taskworkrun() fput() fput() perfrelease() perfrelease() perfeventreleasekernel() perfeventreleasekernel() freeevent() freeevent() perfpendingtasksync() perfpendingtasksync() rcuwaitwaitevent() rcuwaitwaitevent()
Therefore the only option left is to acquire the event reference count upon queueing the perf task work and release it from the task work, just like it was done before 3a5465418f5f ("perf: Fix event leak upon exec and file release") but without the leaks it fixed.
Some adjustments are necessary to make it work:
A child event might dereference its parent upon freeing. Care must be taken to release the parent last.
Some places assuming the event doesn't have any reference held and therefore can be freed right away must instead put the reference and let the reference counting to its job.
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2025-37747?
CVE-2025-37747 has been assigned a severity level that indicates a significant risk to systems utilizing the affected Linux kernel.
How do I fix CVE-2025-37747?
To fix CVE-2025-37747, ensure that you update to the latest patched version of the Linux kernel.
What systems are affected by CVE-2025-37747?
CVE-2025-37747 affects various versions of the Linux kernel where the perf subsystem is utilized.
What causes the hang in CVE-2025-37747?
The hang in CVE-2025-37747 is caused by an issue where perf can hang while freeing a sigtrap event if the related deferred signal has not been sent.
Is CVE-2025-37747 remotely exploitable?
CVE-2025-37747 does not appear to be remotely exploitable, as it requires local access to the affected system.