Re: [RFC PATCH 07/13] rootns: Add rootns_enter() system call
From: Andy Lutomirski
Date: Tue Nov 17 2026 - 12:42:56 EST
On Mon, Nov 16, 2026 at 9:09 PM Jarkko Sakkinen <jarkko@xxxxxxxxxx> 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?
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.
--Andy