CVE-2026-139089: ucount: read the parent ucounts before dropping the rlimit count
In the Linux kernel, the following vulnerability has been resolved:
ucount: read the parent ucounts before dropping the rlimit count
dodecrlimitputucounts() drops its share of iter->rlimit[type] and only then loads iter->ns->ucounts. If the decrement leaves the count non-zero, a concurrent caller can take it to zero and put the last reference, which frees the ucounts and possibly its user namespace with kfreercu(). An exiting task frees its pending signals without siglock or any RCU read-side section, so when it is preempted between the decrement and the load for a grace period it reads freed memory and then decrements a counter through the pointer it found there.
A pending signal holds no reference on its ucounts: the reference is taken by whoever moves the count from 0 to 1 and dropped by whoever moves it back to 0, so the caller's share of the count is all that keeps iter alive, and only until it is dropped.
Load the parent first; it stays pinned by the caller's share of its own count.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.15 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 5.15.226 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.1.193 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.6.163 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.12.119 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.65 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.6 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 7.3.6-1
Event History
Frequently Asked Questions
What runtime conditions are required for the use-after-free to occur?
The race requires do_dec_rlimit_put_ucounts() to drop its rlimit count, then be preempted before it reads the parent ucounts. A concurrent caller must reduce the relevant count to zero and release the final reference, allowing the ucounts object and potentially its user namespace to be freed before the original caller dereferences it.
Why can task exit make this race unsafe?
An exiting task frees pending signals without holding siglock or an RCU read-side section. If it is preempted during the vulnerable interval for long enough to pass an RCU grace period, it can read freed memory and decrement a counter through the stale pointer.
What remediation is identified?
The fix reads the parent ucounts before dropping the rlimit count, so the caller's existing count share keeps the parent pinned while it is accessed. The advisory provides stable-kernel commit references for the resolved issue, but does not provide affected or fixed version numbers.