Re: [patch 0/8] unprivileged mount syscall

Serge E. Hallyn
2007-04-11T20:05:45Z

Quoting Miklos Szeredi (miklos-sUDqSbJrdHQHWmgEVkV9KA@public.gmane.org):
> > It would be nice in general if we could avoid any sort of checks for
> > (mnt->mnt_ns == init_nsproxy.mnt_ns). Maybe that won't be possible,
> > but, taking the two listed examples:
>
> [snip]
>
> It's probably worthwile going after these problematic cases, and
> fixing them, OTOH it's not easy to audit a complete system for holes
> arising from user mounts in the global namespace.
>
> So why not move this decision out from the kernel? How about adding a
> boolean flag to namespaces, which specifies whether unprivileged
> mounts are allowed or not. This would give complete flexibility to
> distro builders and sysadmins.
>
> The biggest problem I see is how to set this flag. There's no easy
> way to represent namespaces in /proc or /sys, and this is sufficiently
> obscure not to warrant a new syscall. Adding a new flag to prctl()
> could do the trick. Does that sound OK?

Not objecting to prctl(), but two other options would be

1. add a CLONE_NEW_NS_USERMNT flag - kind of ugly, but that is
the time at which the ns is created, so in that sense it
makes sense.
2. use the nsproxy container subsystem (see Paul Menage's
containers patchset) to set this using, e.g.,

echo 1 > /containers/vserver1/mounts/usermount

The prctl() method has a huge advantage of being implementable right
now.

-serge