From 1355b868ab626c36fb84afbd9812b38c845d2d4e Mon Sep 17 00:00:00 2001 From: aymericdd Date: Wed, 25 Feb 2026 17:04:30 +0100 Subject: [PATCH] fix(cgroup): filter name=* subsystems on cgroupv1 On cgroupv1, /proc/PID/cgroup contains a "name=systemd" named hierarchy. Using this key as a mount directory name produces an invalid path (/sys/fs/cgroup/name=systemd/...) that doesn't exist on disk, causing EnterPid to fail before any resource controller is joined. Filter name=* entries at construction time in newAllCGroupManager so only real resource controllers reach EnterPid. --- cgroup/manager_linux.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cgroup/manager_linux.go b/cgroup/manager_linux.go index a988437f7..062d5afd7 100644 --- a/cgroup/manager_linux.go +++ b/cgroup/manager_linux.go @@ -7,6 +7,7 @@ package cgroup import ( "path/filepath" + "strings" "github.com/opencontainers/runc/libcontainer/cgroups" "github.com/opencontainers/runc/libcontainer/cgroups/fs" @@ -37,6 +38,13 @@ func newAllCGroupManager(cgroupFile string, cgroupMount string, log *zap.Sugared // prefix the cgroup path with the mount point path for subsystem, path := range cgroupPaths { + // Skip named hierarchies (e.g. "name=systemd"): they are not resource controllers + // and their mount directory name differs from the subsystem key, making the path wrong. + if strings.HasPrefix(subsystem, "name=") { + delete(cgroupPaths, subsystem) + continue + } + log.Debugw("adding cgroup subsystem path to manager", tags.SubsystemKey, subsystem, tags.PathKey, path) cgroupPaths[subsystem] = filepath.Join(cgroupMount, subsystem, path) }