]> git.ipfire.org Git - thirdparty/systemd.git/commit
core/unit: refuse to spawn units under frozen cgroup
authorMike Yuan <me@yhndnzj.com>
Fri, 31 May 2024 04:41:31 +0000 (12:41 +0800)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 31 May 2024 11:25:20 +0000 (13:25 +0200)
commit3b23501a0d5591a2a6624294b7caf897eb4b7f5a
tree47f130e1cfb28dded0e0bb6571cf22b4eb82d847
parent87d6cedfdb15eec247d8b456503de1074b8f945e
core/unit: refuse to spawn units under frozen cgroup

Currently, Unit.freezer_state is always initialized to
FREEZER_RUNNING. While realizing cgroups for frozen units
was disabled in 7923e9493c48694b32d1a6de7b9a996c0194bf17,
the commit only checked for freezer_state of the unit inself,
meaning that newly-loaded units might be started and the kernel
would hang pid1 when trying to spawn sd-executor into sub-cgroup.
This can be easily reproduced by the following:

```console
# systemd-run --slice=test.slice sleep infinity
# systemctl freeze test.slice
# systemd-run --slice=test.slice sleep infinity
```

Therefore, let's correctly initialize Unit.freezer_state
based on the parent slice.
src/core/unit.c