Skip to contentSkip to conversation

CVE-2026-98992: namespace: don't copy an unmounted mount tree

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Oct 23

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

namespace: don't copy an unmounted mount tree

may_copy_tree() accepts a mount whose root is an nsfs or pidfs file before it checks whether that mount is mounted. This exception exists for nsfs and pidfs mounts. They are part of no mount namespace so neither check_mnt() nor is_mounted() would let them through and bind-mounting a nsfsfd or a pidfd wouldn't work.

Problem is that exception also admits a bind mount of such a file when it was lazily unmounted and is only kept alive by a file descriptor:

  mount --bind /proc/self/ns/net /tmp/x
  exec 3< /tmp/x
  umount -l /tmp/x
  mount --rbind /proc/self/fd/3 /tmp/y

With MS_REC or AT_RECURSIVE copy_tree() doesn't stop at the unmounted mount. It copies every mount that stayed attached to it as well. So if you have a bunch of overmounts over the nsfsfd or the pidfd the whole unmounted stack is copied. That's a bug.

So refuse to walk an unmounted tree. Copying its root alone stays possible. So a bind mount of a namespace that is gone can still be recreated from a file descriptor on the old one. The file descriptor pins that mount and its root and __has_locked_children() only reads the direct children which don't leave the parent's list without namespace_sem. The internal mounts carry MNT_NS_INTERNAL instead of NULL and are still walked. Copying an unmounted tree recursively fails with EINVAL.

The Linux kernel CVE team has assigned CVE-2026-98992 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 3.19 with commit e149ed2b805fefdccf7ccdfc19eca22fdd4514ac and fixed in 6.6.160 with commit 86a2d56b1960720bf1844441c0890621e9db2f25
	Issue introduced in 3.19 with commit e149ed2b805fefdccf7ccdfc19eca22fdd4514ac and fixed in 6.12.113 with commit 7e037b1fd339d865737c8accd29abcf40130a5a0
	Issue introduced in 3.19 with commit e149ed2b805fefdccf7ccdfc19eca22fdd4514ac and fixed in 6.18.57 with commit b47b40c4f058418f9707454543179df240796aad
	Issue introduced in 3.19 with commit e149ed2b805fefdccf7ccdfc19eca22fdd4514ac and fixed in 7.2.11 with commit 8d3527457e183cedee3003c2897314da49488311
	Issue introduced in 3.19 with commit e149ed2b805fefdccf7ccdfc19eca22fdd4514ac and fixed in 7.3 with commit 8bacbf6be959973b28b691713a872c12eae69eec

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-98992

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/86a2d56b1960720bf1844441c0890621e9db2f25
	https://git.kernel.org/stable/c/7e037b1fd339d865737c8accd29abcf40130a5a0
	https://git.kernel.org/stable/c/b47b40c4f058418f9707454543179df240796aad
	https://git.kernel.org/stable/c/8d3527457e183cedee3003c2897314da49488311
	https://git.kernel.org/stable/c/8bacbf6be959973b28b691713a872c12eae69eec