[PATCH v2 1/2] man/man2/statmount.2: Fix STATMOUNT_MNT_{UID,GID}MAP documentation
Bhavik Sachdev <[email protected]> Thu, 19 Mar 2026 12:39:11 +0530
| Newsgroups | dev.linux.lists.criu,org.kernel.vger.linux-man |
|---|---|
| Message-ID | <8e3b0ce5a322e253ddad52e10875ce37c9c005cd.1773904035.git.b.sachdev1904@gmail.com> |
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>
Fixes: 9968ead5 (2026-03-05; "man/man2/statmount.2: Document STATMOUNT_{UIDMAP,GIDMAP}")
Signed-off-by: Bhavik Sachdev <[email protected]>
---
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 42ca902d..78b6e9be 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