LPC 2020 Hackroom Session: summary and next steps for isolated user namespaces

Giuseppe Scrivano gscrivan at redhat.com
Mon Oct 12 17:05:10 UTC 2020


Josh Triplett <josh at joshtriplett.org> writes:

> On Fri, Oct 09, 2020 at 11:26:06PM -0500, Serge E. Hallyn wrote:
>> > 3. Find a way to allow setgroups() in a user namespace while keeping
>> >    in mind the case of groups used for negative access control.
>> >    This was suggested by Josh Triplett and Geoffrey Thomas. Their idea was to
>> >    investigate adding a prctl() to allow setgroups() to be called in a user
>> >    namespace at the cost of restricting paths to the most restrictive
>> >    permission. So if something is 0707 it needs to be treated as if it's 0000
>> >    even though the caller is not in its owning group which is used for negative
>> >    access control (how these new semantics will interact with ACLs will also
>> >    need to be looked into).
>> 
>> I should probably think this through more, but for this problem, would it
>> not suffice to add a new prevgroups grouplist to the struct cred, maybe
>> struct group_info *locked_groups, and every time an unprivileged task creates
>> a new user namespace, add all its current groups to this list?
>
> So, effectively, you would be allowed to drop permissions, but
> locked_groups would still be checked for restrictions?
>
> That seems like it'd introduce a new level of complexity (a new facet of
> permission) to manage. Not opposed, but it does seem more complex than
> just opting out of using groups for negative permissions.

I have played with something similar in the past.  At that time I've
discussed it only privately with Eric and we agreed it wasn't worth the
extra complexity:

https://github.com/giuseppe/linux/commit/7e0701b389c497472d11fab8570c153a414050af

instead of a prctl, I've added a new mode to /proc/PID/setgroups that
allows setgroups in a userns locking the current gids.

What do you think about using /proc/PID/setgroups instead of a new
prctl()?

Giuseppe



More information about the Containers mailing list