Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

oci: make sure cgroupns is enabled if supported #4003

Merged
merged 2 commits into from
Jul 10, 2023

Conversation

tonistiigi
Copy link
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>
@@ -139,3 +146,12 @@ func getTracingSocketMount(socket string) specs.Mount {
func getTracingSocket() string {
return fmt.Sprintf("unix://%s", tracingSocketPath)
}

func cgroupNamespaceSupported() bool {
Copy link
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
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
Member

Choose a reason for hiding this comment

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

Copy link
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
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 merged commit f21a96c into moby:master Jul 10, 2023
54 checks passed
@tonistiigi
Copy link
Member Author

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

@tiborvass
Copy link
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.

None yet

4 participants