From: Jarkko Sakkinen <jarkko@kernel.org>
To: Paul Moore <paul@paul-moore.com>
Cc: linux-api@vger.kernel.org, linux-doc@vger.kernel.org,
linux-fsdevel@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>,
Andy Lutomirski <luto@amacapital.net>,
Anna-Maria Behnsen <anna-maria@linutronix.de>,
Ben Segall <bsegall@google.com>,
Christian Brauner <brauner@kernel.org>,
David Hildenbrand <david@kernel.org>,
Davidlohr Bueso <dave@stgolabs.net>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Frederic Weisbecker <frederic@kernel.org>,
Ingo Molnar <mingo@redhat.com>, Jan Kara <jack@suse.cz>,
John Johansen <john.johansen@canonical.com>,
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>,
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>,
Thomas Gleixner <tglx@kernel.org>,
Valentin Schneider <vschneid@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Vincenzo Frascino <vincenzo.frascino@arm.com>,
Vlastimil Babka <vbabka@kernel.org>,
Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Subject: Re: [RFC PATCH v3 00/13] Namespace for namespace roots
Date: Thu, 19 Nov 2026 08:21:27 +0200 [thread overview]
Message-ID: <av6VZ5NQG4GwYvPl@kernel.org> (raw)
In-Reply-To: <av5-Zc4xhgkPxb7p@kernel.org>
On Thu, Nov 19, 2026 at 06:43:21AM +0200, Jarkko Sakkinen wrote:
> On Wed, Nov 18, 2026 at 10:42:10PM +0200, Jarkko Sakkinen wrote:
> > > I.e. before PID 1 and /proc/<pid>/ns/* existss, nsfd for namespace other
> > > than root nsfd can be acquired as follows:
> > >
> > > int mnts_fd = ioctl(root_fd, ROOTNS_GET_NSFD, CLONE_NEWNS);
> >
> >
> > Unprivileged caller becomes the owner of rootns->user_ns. Each mount
> > syscall then just checks CAP_SYS_ADMIN against rootns->user_ns.
> >
> > The user space wiring goes along the lines of:
> >
> > int root_fd = rootns_create(ROOTNS_KILL_ON_CLOSE | ROOTNS_CLOSE_ON_EXEC);
> > int mntns_fd = ioctl(root_fd, ROOTNS_GET_NSFD, CLONE_NEWNS);
> >
> > int tmpfs_fd = fsopen("tmpfs", 0);
> > fsconfig(tmpfs_fd, FSCONFIG_SET_ROOTNS, NULL, NULL, root_fd);
> > fsconfig(tmpfs_fd, FSCONFIG_CMD_CREATE, NULL, NULL, 0);
> > int rootfs_fd = fsmount(tmpfs_fd, 0, 0);
> >
> > move_mount(rootfs_fd, "", mntns_fd, "/", MOVE_MOUNT_F_EMPTY_PATH | MOVE_MOUNT_T_MNTNS);
> >
> > struct clone_args args = {
> > .flags = CLONE_INTO_ROOTNS,
> > .rootns = root_fd,
> > };
> > pid_t pid = clone3(&args, sizeof(args));
>
>
> [BTW, this patch set is pointed out to David and not fsdevel mailing by a
> mishap, apologies.]
>
> I reduced syscalls can be further to only a single syscall: rootns()
>
> The complete API after this:
>
> 1. rootns(flags)
> 2. ioctl(rootfs_fd, ROOTNS_GET_NSFD, ns)
> 3. ioctl(rootfs_fd, ROOTNS_WAIT, NULL)
> 4. ioctl(rootfs_fd, ROOTNS_KILL, signum)
>
> An updated version of the patch set is available over here:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/jarkko/linux-tpmdd.git/log/?h=rootns
>
> In order to find more evidence that the API is trimmed and code has no
> extra fat, I tried how LSM hooks size-fit.
>
> Attached are the experimental LSM hooks and while possibly not exactly
> right they should not be at least in the ballpar (Paul?).
>
> Not perfect, but very usable, and there's a steady track of convergence
> where resolving a bottleneck leads into a better symmetry and coherency
> overall.
Orthogonally, solely fd-local security model (as all is tied to fd) is
the best thing ever when defining mandatory access control policies as
the full flow can be meaningfully described; i.e. roonts(), sendmsg()
and other calls track the fd's data flow with almost the highest
achievable granularity.
Br, Jarkko
next prev parent reply other threads:[~2026-11-19 6:21 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 19:35 [RFC PATCH v3 00/13] Namespace for namespace roots Jarkko Sakkinen
2026-11-18 19:35 ` [RFC PATCH v3 01/13] nsproxy: Pass nsproxy to create_new_namespaces() Jarkko Sakkinen
2026-11-19 19:36 ` sashiko-bot
2026-11-18 19:35 ` [RFC PATCH v3 02/13] rootns: Add core infrastructure for root namespaces Jarkko Sakkinen
2026-11-19 19:36 ` sashiko-bot
2026-11-18 19:35 ` [RFC PATCH v3 03/13] rootns: Track init lifecycle via copy_process() and pid_namespace Jarkko Sakkinen
2026-11-19 19:36 ` sashiko-bot
2026-11-18 19:35 ` [RFC PATCH v3 04/13] rootns: Add rootns_create() system call Jarkko Sakkinen
2026-11-19 19:36 ` sashiko-bot
2026-11-18 19:35 ` [RFC PATCH v3 05/13] rootns: Add rootns_wait() " Jarkko Sakkinen
2026-11-19 19:36 ` sashiko-bot
2026-11-18 19:35 ` [RFC PATCH v3 06/13] rootns: Add rootns_kill() " Jarkko Sakkinen
2026-11-19 19:36 ` sashiko-bot
2026-11-18 19:35 ` [RFC PATCH v3 07/13] fork: Support CLONE_INTO_ROOTNS in clone3() Jarkko Sakkinen
2026-11-19 19:36 ` sashiko-bot
2026-11-18 19:35 ` [RFC PATCH v3 08/13] fs: Support FSCONFIG_SET_ROOTNS in fsconfig() Jarkko Sakkinen
2026-11-19 19:36 ` sashiko-bot
2026-11-18 19:35 ` [RFC PATCH v3 09/13] fs: Support MOVE_MOUNT_T_MNTNS in move_mount() Jarkko Sakkinen
2026-11-19 19:36 ` sashiko-bot
2026-11-18 19:35 ` [RFC PATCH v3 10/13] arch: Wire up rootns system calls Jarkko Sakkinen
2026-11-19 19:37 ` sashiko-bot
2026-11-18 19:35 ` [RFC PATCH v3 11/13] docs: Document root namespace uAPI Jarkko Sakkinen
2026-11-19 19:37 ` sashiko-bot
2026-11-18 19:35 ` [RFC PATCH v3 12/13] selftests/rootns: Add root namespace test suite Jarkko Sakkinen
2026-11-19 19:37 ` sashiko-bot
2026-11-18 19:35 ` [RFC PATCH v3 13/13] MAINTAINERS: Add entry for ROOT NAMESPACE Jarkko Sakkinen
2026-11-18 19:54 ` [RFC PATCH v3 00/13] Namespace for namespace roots Jarkko Sakkinen
2026-11-18 20:42 ` Jarkko Sakkinen
2026-11-18 21:22 ` Jarkko Sakkinen
2026-11-19 4:43 ` Jarkko Sakkinen
2026-11-19 6:21 ` Jarkko Sakkinen [this message]
2026-11-18 22:36 ` Vlastimil Babka (SUSE)
2026-11-18 23:33 ` 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=av6VZ5NQG4GwYvPl@kernel.org \
--to=jarkko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=anna-maria@linutronix.de \
--cc=brauner@kernel.org \
--cc=bsegall@google.com \
--cc=corbet@lwn.net \
--cc=dave@stgolabs.net \
--cc=david@kernel.org \
--cc=dietmar.eggemann@arm.com \
--cc=frederic@kernel.org \
--cc=jack@suse.cz \
--cc=john.johansen@canonical.com \
--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=tglx@kernel.org \
--cc=vbabka@kernel.org \
--cc=vincent.guittot@linaro.org \
--cc=vincenzo.frascino@arm.com \
--cc=viro@zeniv.linux.org.uk \
--cc=vschneid@redhat.com \
--cc=zygmunt.krynicki@canonical.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.