Files
Theodore-Liu 1855f879fb fix(libcontainer): derive default cgroupfs path from current cgroup (#3706)
* fix(libcontainer): derive default cgroupfs path from current cgroup

When the OCI spec omits linux.cgroupsPath, youki always generates a
systemd-style default. With rootless Podman using cgroupfs, this does not
place the container payload in a dedicated cgroup, so Podman's cgroup
contains multiple processes.

Choose the default path based on the active cgroup manager. Preserve the
existing systemd path, and for cgroupfs derive a sibling cgroup named after
the container ID from youki's current cgroup. Use the same path for
container setup, saved configuration, and cleanup, and add regression tests
for the cgroupfs path resolution.

Fixes #3690

Signed-off-by: Jingze Liu <110184138+Theodore-Liu@users.noreply.github.com>

* fix(libcontainer): read /proc/self/cgroup via ProcfsHandle and let exec use the saved cgroup path

Address review on #3706:
- get_cgroup_path_for_manager reads /proc/self/cgroup through pathrs'
  ProcfsHandle (as rootfs/mount.rs does) instead of procfs::Process::myself(),
  with a CgroupPathError covering the open and parse errors.
- ContainerBuilderImpl takes the base cgroup path from its caller: the init
  builder passes the path it saved in YoukiConfig, and the tenant builder loads
  that saved path, so exec joins the cgroup the container was created in instead
  of deriving it again from the calling process's cgroup.

Signed-off-by: Jingze Liu <110184138+Theodore-Liu@users.noreply.github.com>

* test(rootless): drop the --cgroup-manager systemd workaround now that cgroupfs derives its default path

#3691 pinned the exec test to the systemd cgroup manager because, with cgroupfs in
rootless mode, youki's default cgroup path (":youki:<id>") did not match what podman
expected (#3690). The default is now derived from the current cgroup, so the test
runs under podman's default cgroup manager again.

Signed-off-by: Jingze Liu <110184138+Theodore-Liu@users.noreply.github.com>

---------

Signed-off-by: Jingze Liu <110184138+Theodore-Liu@users.noreply.github.com>
2026-10-10 13:36:01 +09:00
..