All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Bhavik Sachdev" <b.sachdev1904@gmail.com>
To: "Alejandro Colomar" <alx@kernel.org>,
	"Bhavik Sachdev" <b.sachdev1904@gmail.com>
Cc: <linux-man@vger.kernel.org>, <criu@lists.linux.dev>,
	"Andrei Vagin" <avagin@gmail.com>,
	"Pavel Tikhomirov" <ptikhomirov@virtuozzo.com>,
	"Jeff Layton" <jlayton@kernel.org>,
	"Miklos Szeredi" <miklos@szeredi.hu>,
	"Josef Bacik" <josef@toxicpanda.com>,
	"Christian Brauner" <brauner@kernel.org>
Subject: Re: [PATCH v1 07/10] man/man2/statmount.2: Document STATMOUNT_{UIDMAP,GIDMAP}
Date: Fri, 13 Feb 2026 15:35:46 +0530	[thread overview]
Message-ID: <DGDR05PJO22F.33BTDW19HI4KM@gmail.com> (raw)
In-Reply-To: <aYyJMflAWPJu7_EQ@devuan>

On Wed Feb 11, 2026 at 7:29 PM IST, Alejandro Colomar wrote:
> Hi Bhavik,

Hey Alex!

>
> On 2026-02-10T02:47:40+0530, Bhavik Sachdev wrote:
>> Document the STATMOUNT_{UIDMAP,GIDMAP} flags and the corresponding
>> fields introduced by them. Most of this is based on the commit message
>> provided here [1].
>> 
>> Link [1]:
>> <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=37c4a9590e1efcae7749682239fc22a330d2d325>
>> 
>> Signed-off-by: Bhavik Sachdev <b.sachdev1904@gmail.com>
>> ---
>>  man/man2/statmount.2 | 34 ++++++++++++++++++++++++++++++++++
>>  1 file changed, 34 insertions(+)
>> 
>> diff --git a/man/man2/statmount.2 b/man/man2/statmount.2
>> index b7acde8f4..4da55eb38 100644
>> --- a/man/man2/statmount.2
>> +++ b/man/man2/statmount.2
>> @@ -56,6 +56,10 @@ .SH SYNOPSIS
>>  .B "    __u32  opt_array;"
>>  .B "    __u32  opt_sec_num;"
>>  .B "    __u32  opt_sec_array;"
>> +.B "    __u32  mnt_uidmap_num;"
>> +.B "    __u32  mnt_uidmap;"
>> +.B "    __u32  mnt_gidmap_num;"
>> +.B "    __u32  mnt_gidmap;"
>>  .B "    char   str[];"
>>  .B };
>>  .EE
>> @@ -120,6 +124,8 @@ .SS The mnt_id_req structure
>>  STATMOUNT_SB_SOURCE	/* Want/got sb_source */
>>  STATMOUNT_OPT_ARRAY	/* Want/got opt_... */
>>  STATMOUNT_OPT_SEC_ARRAY	/* Want/got opt_sec... */
>> +STATMOUNT_MNT_UIDMAP	/* Want/got uidmap... */
>> +STATMOUNT_MNT_GIDMAP	/* Want/got gidmap... */
>>  .TE
>>  .in
>>  .P
>> @@ -299,6 +305,34 @@ .SS The returned information
>>  buffer that contains security options separated by null bytes.
>>  They can be iterated over the help of
>>  .IR smbuf.opt_sec_num .
>> +.TP
>> +.I smbuf.mnt_uidmap_num
>> +The number of uid mappings in case of an idmapped mount.
>> +If STATMOUNT_UIDMAP was not unset and this field is 0,
>
> "If ... was not unset" is confusing.  As far as I can read, the .param
> field is an ORed combination of flags, so usually you set things,
> because otherwise you get 0.
>
> The wording seems to imply that something is set by default and I'd need
> to unset it explicitly.
>
> Am I missing something?
>
> Should this say "If ... was set"?
>

The patch implicitly refers to the smbuf.mask field, which is a ORed
combination of the flags statmount() was actually able to successfully
fill.

So, if smbuf.mask has STATMOUNT_UIDMAP set (i.e the kernel was able to
successfully get the uid mappings of the mount) and smbuf.mnt_uidmap_num
is 0, then the mount is not a idmapped mount.

The patch does a terrible job of explaining this, i will come up with
something better.

>> +the mount is not an idmapped mount.
>> +.TP
>> +.I smbuf.mnt_uidmap
>> +The offset to the location in the
>> +.I smbuf.str
>> +buffer that contains uid mappings as string array separated by null bytes.
>> +They can be iterated over with the help of
>> +.IR smbuf.mnt_uidmap_num .
>> +The whole range of uid mappings must be resolvable inthe caller's user
>
> s/inthe/in the/
>
>> +namespace.
>
> I think "the user namespace of the caller" reads better.
>

I agree.

>> +.TP
>> +.I smbuf.mnt_gidmap_num
>> +The number of gid mappings in case of an idmapped mount.
>> +If STATMOUNT_GIDMAP was not unset and this field is 0,
>> +the mount is not an idmapped mount.
>> +.TP
>> +.I smbuf.mnt_gidmap
>> +The offset to the location in the
>> +.I smbuf.str
>> +buffer that contains uid mappings as string array separated by null bytes.
>
> What do you mean by 'string array'?  Array is confusing, because it
> doesn't match the C concept of an array, since that would require all
> elements to have the same exact size.
>
> How about 'consecutive null-terminated strings'?

I agree.

>
>

I have taken a look at the rest of your comments as well, I will send
out a revision with the fixes soon!
Thanks for all your help :)

> Cheers,
> Alex
>
>> +They can be iterated over with the help of
>> +.IR smbuf.mnt_gidmap_num .
>> +The whole range of gid mappings must be resolvable in the caller's user
>> +namespace.
>>  .SH RETURN VALUE
>>  On success, zero is returned.
>>  On error, \-1 is returned, and
>> -- 
>> 2.53.0
>> 
>> 


  reply	other threads:[~2026-02-13 10:05 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-09 21:17 [PATCH v1 00/10] man/man2/statmount.2: Document New Features Bhavik Sachdev
2026-02-09 21:17 ` [PATCH v1 01/10] man/man2/statmount.2: Document req.mnt_ns_id and STATMOUNT_MNT_NS_ID Bhavik Sachdev
2026-02-11 13:39   ` Alejandro Colomar
2026-02-09 21:17 ` [PATCH v1 02/10] man/man2/statmount.2: Document STATMOUNT_MNT_OPTS Bhavik Sachdev
2026-02-11 13:43   ` Alejandro Colomar
2026-02-09 21:17 ` [PATCH v1 03/10] man/man2/statmount.2: Document STATMOUNT_FS_SUBTYPE Bhavik Sachdev
2026-02-09 21:17 ` [PATCH v1 04/10] man/man2/statmount.2: Document STATMOUNT_SB_SOURCE Bhavik Sachdev
2026-02-09 21:17 ` [PATCH v1 05/10] man/man2/statmount.2: Document STATMOUNT_OPT_ARRAY Bhavik Sachdev
2026-02-11 13:45   ` Alejandro Colomar
2026-02-09 21:17 ` [PATCH v1 06/10] man/man2/statmount.2: Document STATMOUNT_OPT_SEC_ARRAY Bhavik Sachdev
2026-02-11 13:49   ` Alejandro Colomar
2026-02-09 21:17 ` [PATCH v1 07/10] man/man2/statmount.2: Document STATMOUNT_{UIDMAP,GIDMAP} Bhavik Sachdev
2026-02-11 13:59   ` Alejandro Colomar
2026-02-13 10:05     ` Bhavik Sachdev [this message]
2026-02-13 13:31       ` Alejandro Colomar
2026-02-09 21:17 ` [PATCH v1 08/10] man/man2/statmount.2: Document STATMOUNT_SUPPORTED_MASK Bhavik Sachdev
2026-02-09 21:17 ` [PATCH v1 09/10] man/man2/statmount.2: Document req.mnt_ns_fd Bhavik Sachdev
2026-02-11 14:01   ` Alejandro Colomar
2026-02-09 21:17 ` [PATCH v1 10/10] man/man2/statmount.2: Document STATMOUNT_BY_FD Bhavik Sachdev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DGDR05PJO22F.33BTDW19HI4KM@gmail.com \
    --to=b.sachdev1904@gmail.com \
    --cc=alx@kernel.org \
    --cc=avagin@gmail.com \
    --cc=brauner@kernel.org \
    --cc=criu@lists.linux.dev \
    --cc=jlayton@kernel.org \
    --cc=josef@toxicpanda.com \
    --cc=linux-man@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=ptikhomirov@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.