opencontainers / opencontainers/cgroups

cgroup ownership (delegation chown) is only implemented in the systemd cgroup manager, not the fs driver

Open
#66 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
29
Forks
32
PR merge metrics
No merged PRs in 30d

Description

The OCI runtime-spec "cgroup ownership" semantics (chown the container's cgroup to the host UID mapping container root, when the container has a private cgroup namespace and cgroupfs is mounted rw) are only implemented for the systemd cgroup driver. With the default fs driver, the cgroup is left owned by init-ns root, so a userns container gets an rw cgroupfs mount whose files are all owned by an unmapped user (nobody:nogroup) and cannot use the delegation it was seemingly granted.

This makes containerd's cgroup_writable CRI option (containerd 2.1+) non-functional for hostUsers: false Kubernetes pods on any host using the fs driver - e.g. distros without systemd (Talos Linux), where the systemd driver is not available at all.

I imagine more users will run into this, given that this flag (cgroup_writable) will soon land in Kubernetes's securityContext as well.

Relevant chunk of code:

https://github.com/opencontainers/cgroups/blob/bedc0485914021ee8c23c9b0005445ccb43508ac/systemd/v2.go#L368-L387

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with systemd/v2.go around lines 368-387, then locate the corresponding ownership and delegation path for the fs driver. Compare the OCI cgroup ownership conditions described in the issue and make the fs driver apply them; done means cgroup_writable works for private user-namespace containers without systemd.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.