]> git.ipfire.org Git - thirdparty/systemd.git/commit
namespace-util: make "setgroups" users property writable via userns_acquire()
authorLennart Poettering <lennart@poettering.net>
Mon, 10 Mar 2025 10:24:59 +0000 (11:24 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 17 Mar 2025 15:03:18 +0000 (16:03 +0100)
commit6431c34b8a8487fb50c9cb850bd7d3bf81ad9e2a
treeba237a59849114a4e3711501217ff29c21bb827f
parent0201114bb7f347015ed4d85256637921dc304fe0
namespace-util: make "setgroups" users property writable via userns_acquire()

Unprivileged namespaces are only allowed if the "setgroups" file is set
to "deny" for processes. And we need to write it before writing the
gidmap. Hence add a parameter for that.

Then, also patch all current users to actually enable this. The usecase
generally don't need it (because they don't care about unprivileged
userns), but it doesn't hurt to enable the concept anyway in all current
users (none of them actually runs complex userspace in them, but they
mostly use userns_acquire() for idmapped mounts and similar).

Let's anyway make this option explicit in the function call, to indicate
that the concept exists and is applied.
src/basic/namespace-util.c
src/basic/namespace-util.h
src/core/namespace.c
src/home/homework-mount.c
src/mountfsd/mountwork.c
src/nsresourced/test-userns-restrict.c
src/shared/mount-util.c
src/test/test-namespace.c