CVE-2026-99844: mount: refuse setns() with a shared fs_struct again
In the Linux kernel, the following vulnerability has been resolved:
mount: refuse setns() with a shared fsstruct again
mntnsinstall() refuses to switch the mount namespace of a task that shares its fsstruct, since root and cwd of the others would move to a namespace they are not in. It looks at nsset->fs for that. If more than the mount namespace is asked for, that is a private copy made by preparensset(), which has one user by definition; commitnsset() then writes root and cwd of the copy to the fsstruct of the task.
A thread of a process with two threads, pidfd of a task in another mount namespace:
setns(pidfd, CLONENEWNS) -EINVAL setns(pidfd, CLONENEWNS | CLONENEWUTS) 0
and after the second call the other thread, still in the old mount namespace, has lost its cwd (/tmp became /) and sees the mounts of the other namespace under /.
Look at the fsstruct that is going to be changed. The second call then fails with -EINVAL like the first one.
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.10.275 - 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.117 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 6.18.63 - Upgrade
Upgrade
linux/Kernelto a version that resolves this vulnerability.Fixed in 7.3.4 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.12.117-1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 7.3.4-1 - Upgrade
Upgrade
debian/linuxto a version that resolves this vulnerability.Fixed in 6.12.117-1Fixed in 7.3.4-1
Event History
Frequently Asked Questions
What conditions are required to trigger the issue?
A process must have at least two threads sharing an fs_struct, and a caller must use setns() through a pidfd for a task in another mount namespace. The problematic path occurs when the setns() request includes CLONE_NEWNS together with at least one additional namespace type, such as CLONE_NEWUTS.
Is a mount-namespace-only setns() request affected?
No. The described CLONE_NEWNS-only request already fails with -EINVAL when the target task shares its fs_struct. The issue was that a combined namespace request could succeed instead.
What is the observable impact if the vulnerable path is reached?
Another thread that remains in its original mount namespace can have its current working directory changed, for example from /tmp to /. It can also see mounts from the other mount namespace beneath its root.
How can the issue be detected or mitigated before applying the fix?
Look for applications that invoke setns() via pidfd with CLONE_NEWNS combined with other namespace flags against multithreaded processes. Avoid those combined requests when the target process has threads sharing an fs_struct; mount-namespace-only requests are rejected with -EINVAL in the described scenario.