Re: [RFC PATCH v10 00/28] runfd: Staged namespace execution

From: Jarkko Sakkinen

Date: Sat Dec 05 2026 - 15:28:30 EST


On Sat, Dec 05, 2026 at 08:53:26PM +0200, Jarkko Sakkinen wrote:
> On Sat, Dec 05, 2026 at 06:56:49PM +0200, Jarkko Sakkinen wrote:
> > On Sat, Dec 05, 2026 at 05:26:05AM +0200, Jarkko Sakkinen wrote:
> > > v10:
> > > - Reduced to *SINGLE* new syscall.
> > > - Rename nsexec_open() to runfd() and update the related interface names.
> > > - Replace userns_set_idmap() with the NS_SET_IDMAP ioctl on the user
> > > namespace descriptor.
> > > - Drop the in-tree nsexec selftests and package the standalone ucells
> > > runner in the Buildroot runfd image.
> > > - Include the runfd kernel-doc in the userspace API manual and register
> > > the ioctl range in a separate patch.
> >
> > LSM pollution is the next potential target of redundancy now that
> > syscall pollution has been fully addressed.
> >
> > At least these are low-hanging fruit:
> >
> > 1. security_runfd_free() is redundant against namespace_free().
> > 2. security_runfd_share() should be replaced a shared hook with
> > Landlock, which already contains an equal hook.
> >
> > I'll address this and then I don't know i.e., need to see first
> > how LSM surface appears after these updates.
> >
> > My goal is to squeeze this patch set around 2000 LOC but not
> > sure if that is possible :-) A realistic bet would be something
> > like 2300 LOC of added complexity but let's see how this goes.
>
> After:
>
> 85 files changed, 2446 insertions(+), 267 deletions(-)
>
> That's ~100 insertions of complexity reduction.
>
> I'll look the remaining LSM surface and try to see if they can be
> tackled; or do they stick. Less is definitely more here.

This is the refined set of hooks and I think all have a place in the
life-cycle:

- runfd_alloc(): authorize creating a run.
- runfd_clone(): authorize spawning into a specific run.
- namespace_use():
- RUNFD_SHARE_NSFD: check whether the caller may add the namespace to
the run.
- clone3(CLONE_INTO_RUN): check whether the caller may enter each
destination namespace it isn’t already in.

Only by a pure guess, I'd expect security vulnerabilities appearing if
namesace_use() is not invoked both at the time of namespace addition and
entrance.

It's a clean LSM surface as far as I'm concerned.

Br, Jarkko