core: change ownership of subcgroup we create recursively, it shall be owned by the user delegated to

If we create a subcroup (regardless if the '.control' subgroup we
always created or one configured via DelegateSubgroup=) it's inside of
the delegated territory of the cgroup tree, hence it should be owned
fully by the unit's users. Hence do so.
This commit is contained in:
Lennart Poettering
2023-04-27 12:18:32 +02:00
parent 18c1e481b6
commit bcd9b98159
3 changed files with 78 additions and 1 deletions
+1 -1
View File
@@ -4904,7 +4904,7 @@ static int exec_child(
return log_unit_error_errno(unit, r, "Failed to acquire cgroup path: %m");
}
if (r > 0) {
r = cg_set_access(SYSTEMD_CGROUP_CONTROLLER, p, uid, gid);
r = cg_set_access_recursive(SYSTEMD_CGROUP_CONTROLLER, p, uid, gid);
if (r < 0) {
*exit_status = EXIT_CGROUP;
return log_unit_error_errno(unit, r, "Failed to adjust control subgroup access: %m");