Skip to content

oci: make sure cgroupns is enabled if supported#4003

Merged
tonistiigi merged 2 commits intomoby:masterfrom
tonistiigi:oci-cgroupns
Jul 10, 2023
Merged

oci: make sure cgroupns is enabled if supported#4003
tonistiigi merged 2 commits intomoby:masterfrom
tonistiigi:oci-cgroupns

Conversation

@tonistiigi
Copy link
Copy Markdown
Member

This is not set by default by containerd default spec but needed for the cgroup mounts to be scoped to the ID by runc.

closes #3985

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
Comment thread executor/oci/spec_unix.go
return fmt.Sprintf("unix://%s", tracingSocketPath)
}

func cgroupNamespaceSupported() bool {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moby, containerd, etc. disables cgroup namespace on cgroup v1 regardless to kernel version/config.

Copy link
Copy Markdown
Member Author

@tonistiigi tonistiigi Jul 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this done? In Runc code I see it checks ns existence for both cgroup versions.

https://github.com/opencontainers/runc/blob/main/libcontainer/rootfs_linux.go#L268

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Iiuc this means privileged containers get host cgroups on v1? Is this what you mean and we should replicate it for --security=insecure. I don't quite see how it makes sense though to have different behaviour for privileged containers based on group versions.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@tonistiigi tonistiigi added this to the v0.12.0 milestone Jul 10, 2023
@tonistiigi tonistiigi merged commit f21a96c into moby:master Jul 10, 2023
@tonistiigi
Copy link
Copy Markdown
Member Author

@AkihiroSuda Merging for v0.12 rc2. Lmk if you think any follow-ups are needed.

@tiborvass
Copy link
Copy Markdown
Collaborator

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants