[PATCH] man/man2/statmount.2: Fix STATMOUNT_MNT_{UID,GID}MAP documentation
From: Bhavik Sachdev <hidden>
Date: 2026-03-17 12:21:32
Subsystem:
the rest · Maintainer:
Linus Torvalds
In case of idmapped mounts and statmount(), three cases can occur:
1. The mount is not an idmapped mount. In this case, smbuf->mask will
*not* have STATMOUNT_MNT_{UID,GID}MAP set.
2. The mount is an idmapped mount but *all* its mappings are *not*
resolvable in the user namespace of the caller.
In this case, smbuf->mask will have STATMOUNT_MNT_{UID,GID}MAP set
but smbuf->mnt_{uid,gid}map_num will be 0.
3. The mount is an idmapped mount and *all* its mappings are resolvable
in the user namespace of the caller.
In this case, smbuf->mask will have STATMOUNT_MNT_{UID,GID}MAP set
and mbuf->mnt_{uid,gid}map_num will be greater than 0.
The current documentation fails to differentiate between case 1 and 2
and incorrectly states that STATMOUNT_MNT_{UID,GID}MAP will be set for
non-idmapped mounts.
We can verify that the above is the case by looking at [1] and is made
explicitly clear by the comment in the implementation [2]. The case for
STATMOUNT_MNT_{UID,GID}MAP not being raised for a non-idmapped mount can
be verified by running this program [3].
[1]:
<https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=37c4a9590e1efcae7749682239fc22a330d2d325>
[2]:
<https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/namespace.c#n5489>
[3]: <https://gist.github.com/bsach64/674264ec69e592f906b2713c9f95060b>
Signed-off-by: Bhavik Sachdev <redacted>
---
Hey Alex!
My understanding of how statmount() differentiated between idmapped
mounts and non-idmapped mounts was incorrect. This patch fixes the
incorrect documentation introduced as a result.
Thanks,
Bhavik
man/man2/statmount.2 | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/man/man2/statmount.2 b/man/man2/statmount.2
index 42ca902d9..40a07181b 100644
--- a/man/man2/statmount.2
+++ b/man/man2/statmount.2@@ -356,7 +356,8 @@ .SS The returned information If .I smbuf.mask has STATMOUNT_UIDMAP set and this field is 0, -the mount is not an idmapped mount. +then uid mappings applied on the mount cannot be resolved in the user namespace +of the caller. .TP .IR smbuf.mnt_uidmap " (since Linux 6.15)" The offset to the location in the
@@ -372,7 +373,8 @@ .SS The returned information If .I smbuf.mask has STATMOUNT_GIDMAP set and this field is 0, -the mount is not an idmapped mount. +then gid mappings applied on the mount cannot be resolved in the user namespace +of the caller. .TP .IR smbuf.mnt_gidmap " (since Linux 6.15)" The offset to the location in the
--
2.53.0