From: Jarkko Sakkinen <jarkko@kernel.org>
To: Andy Lutomirski <luto@amacapital.net>
Cc: linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-mm@kvack.org,
linux-security-module@vger.kernel.org,
Alexander Viro <viro@zeniv.linux.org.uk>,
Andrew Morton <akpm@linux-foundation.org>,
Ben Segall <bsegall@google.com>,
Christian Brauner <brauner@kernel.org>,
David Hildenbrand <david@kernel.org>,
David Howells <dhowells@redhat.com>,
Davidlohr Bueso <dave@stgolabs.net>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Ingo Molnar <mingo@redhat.com>, Jan Kara <jack@suse.cz>,
Jonathan Corbet <corbet@lwn.net>,
Juri Lelli <juri.lelli@redhat.com>, Kees Cook <kees@kernel.org>,
K Prateek Nayak <kprateek.nayak@amd.com>,
"Liam R. Howlett" <liam@infradead.org>,
Lorenzo Stoakes <ljs@kernel.org>,
Manfred Spraul <manfred@colorfullife.com>,
Mel Gorman <mgorman@suse.de>, Michal Hocko <mhocko@suse.com>,
Mike Rapoport <rppt@kernel.org>, Neal Gompa <neal@gompa.dev>,
Paul Moore <paul@paul-moore.com>,
Pavel Tikhomirov <ptikhomirov@virtuozzo.com>,
Peter Zijlstra <peterz@infradead.org>,
Randy Dunlap <rdunlap@infradead.org>,
Serge Hallyn <sergeh@kernel.org>,
Shuah Khan <skhan@linuxfoundation.org>,
Steven Rostedt <rostedt@goodmis.org>,
Suren Baghdasaryan <surenb@google.com>,
Valentin Schneider <vschneid@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Vlastimil Babka <vbabka@kernel.org>
Subject: Re: [RFC PATCH 07/13] rootns: Add rootns_enter() system call
Date: Tue, 17 Nov 2026 22:03:34 +0200 [thread overview]
Message-ID: <avyzFnKQrNOid25y@kernel.org> (raw)
In-Reply-To: <CALCETrWtbUFQGDOCHkxAN9O4i29ixfL5KKF1Cqw2-CjxKwC6gQ@mail.gmail.com>
On Tue, Nov 17, 2026 at 09:42:26AM -0800, Andy Lutomirski wrote:
> On Mon, Nov 16, 2026 at 9:09 PM Jarkko Sakkinen <jarkko@kernel.org> wrote:
> >
> > Multithreaded userspace daemons cannot call setns(CLONE_NEWUSER) or
> > safely mutate process-wide filesystem state in place before spawning a
> > child into a target namespace set.
> >
> > Add the rootns_enter() system call to fork a child process directly into
> > a rootns whose root mount has been installed. Transition the rootns from
> > ROOTNS_READY through ROOTNS_FORKING to ROOTNS_RUNNING for the first
> > process so it becomes PID 1, serialize concurrent entrants on waitq
> > until bootstrap resolves, and admit subsequent callers into the running
> > PID namespace until teardown begins.
> >
> > Require CAP_SYS_ADMIN in the target user namespace, forbid credential or
> > PR_SET_NO_NEW_PRIVS privilege escalation
>
> Why are you disallowing this if no_new_privs?
For no any good reason at all apparently: no_new_privs is inherited by
the child and only restricts privilege gain across execve(), whereas
user_namespace transitions are allowed under it.
So yeah, it's a spurious check, and thus I'll drop it.
> This isn't necessarily a showstopper, but fork() is really quite slow
> in many cases. It would be nice to have a more spawn-like API
> available. I assume it's possible to open a file in the target's
> mountns by some sane API even without entering that mountns, as a side
> effect of how the fsopen / move_mount mechanism works.
If the caller retains the O_PATH fd returned by fsmount() for "/", it is
able to open files inside the target mount tree via openat2(...,
RESOLVE_IN_ROOT) w/o entering the mount namespace, and pass the
resulting fd to execveat().
For avoiding full fork(), there are (at least) two options:
1. A rootns flag in clone3() (e.g., CLONE_INTO_ROOTNS) and a rootns fd
in struct clone_args (disallowing incompatible CLONE_NEW*, CLONE_FS,
CLONE_THREAD, ...), and callers can pair it with CLONE_VM | CLONE_VFORK.
2. A flags parameter in rootns_enter() (e.g., ROOTNS_ENTER_VFORK), which
would map directly to CLONE_VM | CLONE_VFORK.
>
> --Andy
Br, Jarkko
next prev parent reply other threads:[~2026-11-17 20:03 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 5:08 [RFC PATCH 00/13] Namespace for namespace roots Jarkko Sakkinen
2026-11-17 5:08 ` [RFC PATCH 01/13] nsproxy: Pass nsproxy to create_new_namespaces() Jarkko Sakkinen
2026-11-18 5:09 ` sashiko-bot
2026-11-17 5:08 ` [RFC PATCH 02/13] rootns: Add core infrastructure for root namespaces Jarkko Sakkinen
2026-11-18 5:09 ` sashiko-bot
2026-11-17 5:08 ` [RFC PATCH 03/13] rootns: Track init lifecycle via copy_process() and pid_namespace Jarkko Sakkinen
2026-11-18 5:09 ` sashiko-bot
2026-11-17 5:08 ` [RFC PATCH 04/13] rootns: Add rootns_create() system call Jarkko Sakkinen
2026-11-18 5:09 ` sashiko-bot
2026-11-17 5:08 ` [RFC PATCH 05/13] rootns: Add rootns_wait() " Jarkko Sakkinen
2026-11-18 5:09 ` sashiko-bot
2026-11-17 5:08 ` [RFC PATCH 06/13] rootns: Add rootns_kill() " Jarkko Sakkinen
2026-11-18 5:09 ` sashiko-bot
2026-11-17 5:08 ` [RFC PATCH 07/13] rootns: Add rootns_enter() " Jarkko Sakkinen
2026-11-17 17:42 ` Andy Lutomirski
2026-11-17 20:03 ` Jarkko Sakkinen [this message]
2026-11-17 20:53 ` Andy Lutomirski
2026-11-18 5:09 ` sashiko-bot
2026-11-17 5:08 ` [RFC PATCH 08/13] fs: Support FSCONFIG_SET_ROOTNS in fsconfig() Jarkko Sakkinen
2026-11-18 5:09 ` sashiko-bot
2026-11-17 5:08 ` [RFC PATCH 09/13] fs: Support installing rootns mount trees via move_mount() Jarkko Sakkinen
2026-11-18 5:09 ` sashiko-bot
2026-11-17 5:08 ` [RFC PATCH 10/13] arch: Wire up rootns system calls Jarkko Sakkinen
2026-11-18 5:09 ` sashiko-bot
2026-11-17 5:08 ` [RFC PATCH 11/13] docs: Document root namespace uAPI Jarkko Sakkinen
2026-11-18 5:09 ` sashiko-bot
2026-11-17 5:08 ` [RFC PATCH 12/13] selftests/rootns: Add root namespace test suite Jarkko Sakkinen
2026-11-18 5:09 ` sashiko-bot
2026-11-17 5:08 ` [RFC PATCH 13/13] MAINTAINERS: Add entry for ROOT NAMESPACE Jarkko Sakkinen
2026-11-17 11:10 ` [RFC PATCH 00/13] Namespace for namespace roots Jarkko Sakkinen
2026-11-17 17:44 ` Andy Lutomirski
2026-11-17 18:48 ` Jarkko Sakkinen
2026-11-17 19:10 ` Jarkko Sakkinen
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=avyzFnKQrNOid25y@kernel.org \
--to=jarkko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=bsegall@google.com \
--cc=corbet@lwn.net \
--cc=dave@stgolabs.net \
--cc=david@kernel.org \
--cc=dhowells@redhat.com \
--cc=dietmar.eggemann@arm.com \
--cc=jack@suse.cz \
--cc=juri.lelli@redhat.com \
--cc=kees@kernel.org \
--cc=kprateek.nayak@amd.com \
--cc=liam@infradead.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-security-module@vger.kernel.org \
--cc=ljs@kernel.org \
--cc=luto@amacapital.net \
--cc=manfred@colorfullife.com \
--cc=mgorman@suse.de \
--cc=mhocko@suse.com \
--cc=mingo@redhat.com \
--cc=neal@gompa.dev \
--cc=paul@paul-moore.com \
--cc=peterz@infradead.org \
--cc=ptikhomirov@virtuozzo.com \
--cc=rdunlap@infradead.org \
--cc=rostedt@goodmis.org \
--cc=rppt@kernel.org \
--cc=sergeh@kernel.org \
--cc=skhan@linuxfoundation.org \
--cc=surenb@google.com \
--cc=vbabka@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=viro@zeniv.linux.org.uk \
--cc=vschneid@redhat.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.