From c047e37a7946cbdfd11eae9842b955ea483fe0ef Mon Sep 17 00:00:00 2001 From: Joachim Wiberg Date: Sat, 15 May 2021 10:29:29 +0200 Subject: [PATCH] cgroup: ensure all services in init group remain as leaf nodes The top-level cgroup init is a leaf group and should be treated as such, even for user setup tasks/services. Signed-off-by: Joachim Wiberg --- src/cgroup.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cgroup.c b/src/cgroup.c index 6c4164eb..1ff1354a 100644 --- a/src/cgroup.c +++ b/src/cgroup.c @@ -172,6 +172,9 @@ int cgroup_service(char *name, int pid, struct cgroup *cg) if (!strcmp(cg->name, "root")) return fnwrite(str("%d", pid), FINIT_CGPATH "/cgroup.procs"); + if (!strcmp(cg->name, "init")) + return fnwrite(str("%d", pid), FINIT_CGPATH "/init/cgroup.procs"); + snprintf(path, sizeof(path), "/sys/fs/cgroup/%s", cg->name); if (fisdir(path)) group = cg->name;