mm/kmemleak: avoid deadlock by moving pr_warn() outside kmemleak_lock
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ c5665868183fec689dbab9fb8505188b2c4f0757 · < a0854de00ce2ee27edf39037e7836ad580eb3350| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
mm/kmemleak: avoid deadlock by moving pr_warn() outside kmemleak_lock
When netpoll is enabled, calling pr_warn_once() while holding kmemleak_lock in mem_pool_alloc() can cause a deadlock due to lock inversion with the netconsole subsystem. This occurs because pr_warn_once() may trigger netpoll, which eventually leads to __alloc_skb() and back into kmemleak code, attempting to reacquire kmemleak_lock.
This is the path for the deadlock.
mem_pool_alloc() -> raw_spin_lock_irqsave(&kmemleak_lock, flags); -> pr_warn_once() -> netconsole subsystem -> netpoll -> __alloc_skb -> __create_object -> raw_spin_lock_irqsave(&kmemleak_lock, flags);
Fix this by setting a flag and issuing the pr_warn_once() after kmemleak_lock is released.
From the CVE record · Linux
With netpoll enabled, a warning issued while mem_pool_alloc() holds kmemleak_lock can re-enter kmemleak through netconsole and deadlock the kernel. The input does not identify an attacker-controlled trigger or specify access or user-interaction requirements.
Anyone running the Linux kernel with netpoll enabled should check their kernel version; affected versions are not specified.