Re: [RFC PATCH v2 00/13] Namespace for namespace roots
From: Jarkko Sakkinen
Date: Fri Nov 20 2026 - 17:36:06 EST
On Fri, Nov 20, 2026 at 11:53:30AM -0800, Andy Lutomirski wrote:
> > nsfs: Support NS_USERNS_SET_IDMAP ioctl
> >
> > Configuring UID, GID, and project ID mappings or disabling setgroups(2)
> > for a user namespace currently requires writing to /proc/<pid>/uid_map,
> > gid_map, projid_map, and setgroups, forcing container managers to spawn a
> > live process before populating a filesystem owned by that user namespace.
> >
> > Add the extensible NS_USERNS_SET_IDMAP ioctl on CLONE_NEWUSER nsfs file
> > descriptors to atomically configure setgroups policy and UID, GID, and
> > project ID mappings before any process enters the namespace. Enforce the
> > same single-write and capability invariants against both current_cred()
> > and filp->f_cred under userns_state_mutex.
> >
> > Signed-off-by: Jarkko Sakkinen <jarkko@xxxxxxxxxx>
> >
>
> I'm highly in favor of this. But maybe not as an ioctl.
>
> If you have an nsfd for a userns and that nsfd is the "control" fd
> (however anyone decides this is formulated), why does f_cred matter?
> It should be possible to create a userns without privilege and
> SCM_RIGHTS the fd to a privileged uidmapd. (I fixed the rather
> screwed up workflow for this in newuidmap/newgidmap a few weeks ago --
> this is remarkably easy to screw up. It'll make it to a distro near
> you some day. It's supposed to *work* even without CAP_SYS_ADMIN in
> the picture, and it did not.)
Sealing was part of my testing mostly to show that the flow itself
is robust for doing "whatever". I'm happier not to include it to the
patch set itself tbh.
+1 for syscall instead of ioctl routing.
I can also likely drop ROOTNS_WAIT and get that also through
pre-existing syscall path. Checking up a few things before
locking in but I think that this can be done.
I think this all is enough material for a single iteration, or I want
to see what world looks like after doing this.
v4 did not produce anything from Sashiko so far, and I still fixed
couple of races too while doing this, so also on that side it makes
sense to iterate.
I skimmed your EPRIV email and get I get it yes but within the patch
set's scope I feel that it would go off the edge. So on that side, I'd
look compatibility of the features rather than bundle them into the
same patch set.
>
> --Andy
Br, Jarkko