public inbox for linux-man@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] man/man2/statmount.2: Fix STATMOUNT_MNT_{UID,GID}MAP documentation
@ 2026-03-17 12:18 Bhavik Sachdev
  2026-03-18  0:48 ` Alejandro Colomar
  0 siblings, 1 reply; 5+ messages in thread
From: Bhavik Sachdev @ 2026-03-17 12:18 UTC (permalink / raw)
  To: Alejandro Colomar
  Cc: Bhavik Sachdev, linux-man, criu, Andrei Vagin, Pavel Tikhomirov,
	Christian Brauner

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 <b.sachdev1904@gmail.com>
---
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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-03-19 16:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-17 12:18 [PATCH] man/man2/statmount.2: Fix STATMOUNT_MNT_{UID,GID}MAP documentation Bhavik Sachdev
2026-03-18  0:48 ` Alejandro Colomar
2026-03-19  7:09   ` [PATCH v2 1/2] " Bhavik Sachdev
2026-03-19  7:09   ` [PATCH v2 2/2] man/man2/statmount.2: Fix incorrect naming of STATMOUNT_MNT_{UID,GID}MAP flags Bhavik Sachdev
2026-03-19 16:44     ` Alejandro Colomar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox