CVE-2026-98979: namespace: refuse an automount below a mount that is in no namespace
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
namespace: refuse an automount below a mount that is in no namespace
It's possible to add autmounts even when the parent mount isn't in the mount namespace of the caller. The only requirement we have is that the parent mount namespace must not be NULL, i.e., unmounted.
Problem is that clone_private_mount() has MNT_NS_INTERNAL which makes that trivially true. So that passes the test and attach_recursive_mnt() accepts that as a mount point and funny enough, count_mounts() dereferences MNT_NS_INTERNAL. The problem is it is an error pointer...
So we can reach this in userspace via fanotify. A filesystem mark on the lower filesystem of an overlay reports paths on the layer clone and reading the event hands out a descriptor on it. For example with debugfs as the lower layer it goes kaboom:
openat(evfd, "tracing", O_DIRECTORY)
Oops: general protection fault KASAN: null-ptr-deref in range [0x1d0-0x1d7] RIP: 0010:count_mounts+0x35/0x200 attach_recursive_mnt finish_automount
And since that sleeping beauty happens under namespace_sem held for writing every mount operation on the system blocks from then on. Congrats.
Use is_mounted() instead which rejects unmounted and internal mounts alike. The open fails with EINVAL just as it did before clone_private_mount() used MNT_NS_INTERNAL.
The Linux kernel CVE team has assigned CVE-2026-98979 to this issue.
Affected and fixed versions
===========================
Issue introduced in 5.8 with commit df820f8de4e481222b17f9bcee7b909ae8167529 and fixed in 6.6.160 with commit 95fb7c259b86f5521f04973040ad492f2bef6f82 Issue introduced in 5.8 with commit df820f8de4e481222b17f9bcee7b909ae8167529 and fixed in 6.12.113 with commit 35f2013f83ef16f9f0331c4c3a8e8d161580d574 Issue introduced in 5.8 with commit df820f8de4e481222b17f9bcee7b909ae8167529 and fixed in 6.18.57 with commit 494c57572d2d5bc2839553ed41aabe92ed0f587c Issue introduced in 5.8 with commit df820f8de4e481222b17f9bcee7b909ae8167529 and fixed in 7.2.11 with commit 776e20e4fdc23c23687b511ffdc80047878049d3 Issue introduced in 5.8 with commit df820f8de4e481222b17f9bcee7b909ae8167529 and fixed in 7.3 with commit ba985ce08471c555af2a2fbe217c1bc2e72a6d8c
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2026-98979
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
fs/namespace.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/95fb7c259b86f5521f04973040ad492f2bef6f82 https://git.kernel.org/stable/c/35f2013f83ef16f9f0331c4c3a8e8d161580d574 https://git.kernel.org/stable/c/494c57572d2d5bc2839553ed41aabe92ed0f587c https://git.kernel.org/stable/c/776e20e4fdc23c23687b511ffdc80047878049d3 https://git.kernel.org/stable/c/ba985ce08471c555af2a2fbe217c1bc2e72a6d8c