From: Alejandro Colomar <alx+linux-man@kernel.org>
To: Christian Brauner <brauner@kernel.org>
Cc: "Niklas Hambüchen" <mail@nh2.me>,
linux-man@vger.kernel.org, linux-api@vger.kernel.org
Subject: Re: man 2 unshare: UNSHARE_EMPTY_MNTNS
Date: Fri, 27 Nov 2026 14:07:58 +0100 [thread overview]
Message-ID: <awl-h1Kdc61JccWC@devuan> (raw)
In-Reply-To: <20261127-rundlich-geldkassette-farbaufnahme-62856c08c80b@brauner>
[-- Attachment #1: Type: text/plain, Size: 1674 bytes --]
[CC += linux-api@]
Hi Christian,
> Date: 2026-11-27 13:51:03+0100
> From: Christian Brauner <brauner@kernel.org>
>
> On Fri, Nov 20, 2026 at 12:22:52AM +0100, Alejandro Colomar wrote:
> > That same commit also adds CLONE_EMPTY_MNTNS (according to the commit
> > message, for clone3(2)). Could you explain why there are two separate
> > flags?
>
> unshare() only takes 32 bits. All of them are taken by legacy CLONE_*
> flags. New clone3() flags live above bit 31 so CLONE_EMPTY_MNTNS (1ULL
> << 37) can't be passed to unshare(). UNSHARE_EMPTY_MNTNS reuses the
> CLONE_PARENT_SETTID bit which has no meaning for unshare(). Both imply
> CLONE_NEWNS.
Hmmm, thanks!
$ git grep -hP -f <(grepc_c -tm CLONE_EMPTY_MNTNS) include/
#define CLONE_EMPTY_MNTNS (1ULL << 37) /* Create an empty mount namespace. */
$ git grep -hP -f <(grepc_c -tm UNSHARE_EMPTY_MNTNS) include/
#define UNSHARE_EMPTY_MNTNS 0x00100000 /* Unshare an empty mount namespace. */
$ git grep -hP -f <(grepc_c -tm CLONE_PARENT_SETTID) include/
#define CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */
Would it make sense to create new UNSHARE_* flags for all the existing
CLONE_* flags that make sense in unshare(2)? That would avoid some
possible confusion.
That is:
$ man 2 unshare | grep -o '^.....CLONE_\w*' | sed s/CLONE/UNSHARE/;
UNSHARE_FILES
UNSHARE_FS
UNSHARE_NEWCGROUP
UNSHARE_NEWIPC
UNSHARE_NEWNET
UNSHARE_NEWNS
UNSHARE_NEWPID
UNSHARE_NEWTIME
UNSHARE_NEWUSER
UNSHARE_NEWUTS
UNSHARE_SYSVSEM
Have a lovely day!
Alex
--
<https://www.alejandro-colomar.es>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Alejandro Colomar <alx+linux-man@kernel.org>
To: Christian Brauner <brauner@kernel.org>
Cc: "Niklas Hambüchen" <mail@nh2.me>,
linux-man@vger.kernel.org, linux-api@vger.kernel.org
Cc: linux-fsdevel@vger.kernel.org, Jan Kara <jack@suse.cz>,
Alexander Viro <viro@zeniv.linux.org.uk>
Subject: Re: man 2 unshare: UNSHARE_EMPTY_MNTNS
Date: Fri, 27 Nov 2026 14:08:04 +0100 [thread overview]
Message-ID: <awl-h1Kdc61JccWC@devuan> (raw)
Message-ID: <20261127130804.V62-5e4QD-ZWpRika0sYfg2KjDTkNWRuxHKDw3E4OLQ@z> (raw)
In-Reply-To: <20261127-rundlich-geldkassette-farbaufnahme-62856c08c80b@brauner>
[-- Attachment #1: Type: text/plain, Size: 1674 bytes --]
[CC += linux-api@]
Hi Christian,
> Date: 2026-11-27 13:51:03+0100
> From: Christian Brauner <brauner@kernel.org>
>
> On Fri, Nov 20, 2026 at 12:22:52AM +0100, Alejandro Colomar wrote:
> > That same commit also adds CLONE_EMPTY_MNTNS (according to the commit
> > message, for clone3(2)). Could you explain why there are two separate
> > flags?
>
> unshare() only takes 32 bits. All of them are taken by legacy CLONE_*
> flags. New clone3() flags live above bit 31 so CLONE_EMPTY_MNTNS (1ULL
> << 37) can't be passed to unshare(). UNSHARE_EMPTY_MNTNS reuses the
> CLONE_PARENT_SETTID bit which has no meaning for unshare(). Both imply
> CLONE_NEWNS.
Hmmm, thanks!
$ git grep -hP -f <(grepc_c -tm CLONE_EMPTY_MNTNS) include/
#define CLONE_EMPTY_MNTNS (1ULL << 37) /* Create an empty mount namespace. */
$ git grep -hP -f <(grepc_c -tm UNSHARE_EMPTY_MNTNS) include/
#define UNSHARE_EMPTY_MNTNS 0x00100000 /* Unshare an empty mount namespace. */
$ git grep -hP -f <(grepc_c -tm CLONE_PARENT_SETTID) include/
#define CLONE_PARENT_SETTID 0x00100000 /* set the TID in the parent */
Would it make sense to create new UNSHARE_* flags for all the existing
CLONE_* flags that make sense in unshare(2)? That would avoid some
possible confusion.
That is:
$ man 2 unshare | grep -o '^.....CLONE_\w*' | sed s/CLONE/UNSHARE/;
UNSHARE_FILES
UNSHARE_FS
UNSHARE_NEWCGROUP
UNSHARE_NEWIPC
UNSHARE_NEWNET
UNSHARE_NEWNS
UNSHARE_NEWPID
UNSHARE_NEWTIME
UNSHARE_NEWUSER
UNSHARE_NEWUTS
UNSHARE_SYSVSEM
Have a lovely day!
Alex
--
<https://www.alejandro-colomar.es>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2026-11-27 13:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 16:42 man 2 unshare: UNSHARE_EMPTY_MNTNS Niklas Hambüchen
2026-11-19 23:22 ` Alejandro Colomar
2026-11-27 12:51 ` Christian Brauner
2026-11-27 13:07 ` Alejandro Colomar [this message]
2026-11-27 13:08 ` Alejandro Colomar
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=awl-h1Kdc61JccWC@devuan \
--to=alx+linux-man@kernel.org \
--cc=brauner@kernel.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-man@vger.kernel.org \
--cc=mail@nh2.me \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox