Currently, if we use a cgroup namespace together with DelegateSubgroup=, the subgroup becomes the root of the cgroup namespace because we move the service process to the subgroup before we unshare the cgroup namespace, and the current cgroup becomes the root of the cgroup namespace when we unshare the cgroup namespace. Let's fix the problem by not moving the service process to the subgroup until we've unshared the cgroup namespace. Note that this doesn't break the primary use case of CLONE_INTO_CGROUP since we still use it to immediately clone into the service main cgroup, just not anymore into the subgroup, but this shouldn't matter in practice. Additionally, we need special handling for control processes, as those *do* need to get spawned into the subcgroup immediately if delegation is configured to avoid violating the cgroupsv2 "no inner processes" rule. Effectively, this leaves us with the following logic: - In exec_spawn(), spawn into subgroup if we're spawning a control process that needs to be spawned into a subgroup immediately. Otherwise, spawn into main service cgroup. - In exec_invoke(), move into subgroup early if we don't need a cgroup namespace. Otherwise, move into subgroup after we've unshared the cgroup namespace.
System and Service Manager
Details
Most documentation is available on systemd's web site.
Assorted, older, general information about systemd can be found in the systemd Wiki.
Information about build requirements is provided in the README file.
Consult our NEWS file for information about what's new in the most recent systemd versions.
Please see the Code Map for information about this repository's layout and content.
Please see the Hacking guide for information on how to hack on systemd and test your modifications.
Please see our Contribution Guidelines for more information about filing GitHub Issues and posting GitHub Pull Requests.
When preparing patches for systemd, please follow our Coding Style Guidelines.
If you are looking for support, please contact our mailing list, join our IRC channel #systemd on libera.chat or Matrix channel
Stable branches with backported patches are available in the stable repo.
We have a security bug bounty program sponsored by the Sovereign Tech Fund hosted on YesWeHack
Repositories with distribution packages built from git main are available on OBS
