]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/core/service.c
core: when Delegate=yes is set for a unit, run ExecStartPre= and friends in a subcgro...
authorLennart Poettering <lennart@poettering.net>
Fri, 16 Nov 2018 19:19:07 +0000 (20:19 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 26 Nov 2018 17:43:23 +0000 (18:43 +0100)
commit78f93209fc7f61f15b12d7a5f74d712bd020b249
tree4fd7ad08a0398f12d899af94641fe7b48a6068b8
parenta0ee3d93bbac50e5076e666bf17ab9939d57d047
core: when Delegate=yes is set for a unit, run ExecStartPre= and friends in a subcgroup of the unit

Otherwise we might conflict with the "no-processes-in-inner-cgroup" rule
of cgroupsv2. Consider nspawn starting up and initializing its cgroup
hierarchy with "supervisor/" and "payload/" as subcgroup, with itself
moved into the former and the payload into the latter. Now, if an
ExecStartPre= is run right after it cannot be placed in the main cgroup,
because that is now in inner cgroup with populated children.

Hence, let's run these helpers in another sub-cgroup .control/ below it.

This is somewhat ugly since it weakens the clear separation of
ownership, but given that this is an explicit contract, and double opt-in should be acceptable.

Fixes: #10482
src/core/execute.c
src/core/execute.h
src/core/service.c