Re: [RFC PATCH v2 00/13] Namespace for namespace roots

From: Andy Lutomirski

Date: Thu Nov 19 2026 - 17:50:27 EST


On Thu, Nov 19, 2026 at 9:30 AM Josef Bacik <josef@xxxxxxxxxxxxxx> wrote:
>
> On Wed, Nov 18, 2026 at 9:46 AM Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:
> > cells: The dance where I create an anonymous mountns, mount stuff into
> > it, and then attach it to the cell is cute. But I think the userns
> > interaction is wrong: you are making me assemble all the mounts in
> > *my* userns and then clone the entire tree into a fresh, non-anonymous
> > mountns bound to the current userns. And that clone operation is not
> > free and serves no actual practical purpose.
>
> The copy buys us nothing, agreed. That's just what the mount API gives
> me to work with today, it's not something cells wants. If I could make
> an empty mount namespace and fill it by fd I'd use that, the "root" slot
> takes a mount namespace fd already. Extending the API for that makes
> sense to me on its own.
>
> The mount namespace staying with the builder's userns is on purpose
> though, that's what keeps the cell from mounting anything no matter what
> capabilities it was given. The builder sets the tree up and hands it
> over, so the cell only ever has what it was given, and the mount code
> isn't something it can attack from the inside.

I don't get it.

Using the builder's user namespace means that the contained processes
can't be ns_capable on mntns->userns. But this solves very few
problems unless you also deny the contained processes the ability to
unshare userns and make a new mountns, and if you can do that, surely
you can also deny the ability to modify the mount namespace.

As just one example, a mount namespace could have a little flag to say
that it's *in* one userns but its owner is a different userns.

>
> > cells: I find it *incredibly annoying* that one generally cannot put
> > new mounts into an existing container using most existing container
> > managers. I hit this on a surprisingly regular basis. You seem to be
> > baking this into the whole cells design. Why?
>
> By design. Allowing changes to a running container is what causes the
> problems. If you need another mount, tear it down and build it again.

What problems?

I get that allowing a running container to modify *its own* mount tree
(or any other mount tree) is a meaningful attack surface.

But the whole ongoing discussion about cap_userns gives a clean way to
deny an entire container the ability to modify mounts (although we may
need to augment it to control mounts if that's a specific concern,
since CAP_SYS_ADMIN is a bit overloaded to say the least). And surely
cells can find a clean way to lock down the container.

--Andy


--
Andy Lutomirski
AMA Capital Management, LLC