]> git.ipfire.org Git - thirdparty/lxc.git/commit
use systemd dbus StartTransientUnit for unpriv cgroup2
authorSerge Hallyn <serge@hallyn.com>
Tue, 21 Jun 2022 12:50:53 +0000 (14:50 +0200)
committerStéphane Graber <stgraber@ubuntu.com>
Mon, 25 Jul 2022 22:12:19 +0000 (18:12 -0400)
commitcfcbdb75f061108021cb233d221e8496ac40c30e
tree3ee6525108049261962fd7af7bd89a448d84d460
parent28726f215084391c398873125e29512ec5b21a2b
use systemd dbus StartTransientUnit for unpriv cgroup2

If, when init'ing cgroups for a container start, we detect that we
are an unprivileged user on a unified-hierarchy-only system, then we
try to request systemd, through dbus api, to create a new scope for
us with delegation.  Call the cgroup it creates for us P1.  We then
create P1/init, move ourselves into there, so we can enable the
controllers for delegation to P1's children through P1/cgroup.subtree_control.

On attach, we try to request systemd attach us to the container's
scope.  We can't do that ourselves in the normal case, as root owns
our login cgroups.

Create a new command api for the lxc monitor to tell lxc-attach the
systemd scope to which to attach.

Changelog:
 * free cgroup_meta.systemd_scope in lxc_conf_free (Thanks Tycho)
 * fix some indent
 * address some (not all) of brauner's feedback

Signed-off-by: Serge Hallyn <serge@hallyn.com>
12 files changed:
.github/workflows/build.yml
.github/workflows/coverity.yml
.github/workflows/sanitizers.sh
.github/workflows/sanitizers.yml
meson.build
meson_options.txt
src/lxc/cgroups/cgfsng.c
src/lxc/commands.c
src/lxc/commands.h
src/lxc/conf.c
src/lxc/conf.h
src/tests/oss-fuzz.sh