Bump oc/cgroups to v0.0.9, improve sub-cgroup checks - #5403
Open
kolyshkin wants to merge 2 commits into
Open
Conversation
See https://github.com/opencontainers/cgroups/releases/tag/v0.0.9 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Contributor
Author
|
Because of opencontainers/cgroups#69 I want to backport this to at least 1.5 but maybe also 1.4. I mean, a buffer overrun from the kernel is no joke. |
The check that a sub-cgroup path (as set by runc exec --cgroup, or libcontainer's Process.SubCgroupPaths) does not escape the container's cgroup was too lax: a plain prefix check also accepts a sibling cgroup whose name starts with the container cgroup name (say, "../foo-suffix" for a container cgroup named "foo"). For addIntoCgroupV1 (used for per-controller sub-cgroup paths, which AddPid does not support) the resulting path is passed to WriteCgroupProc as is, so the pid did end up in the sibling cgroup. For prepareCgroupFD the subsequent cgroups.OpenFile call cleans the path, so nothing escaped in practice, but the check was wrong nevertheless. Use the same check as opencontainers/cgroups v0.0.9 does in AddPid, and add test cases for both code paths. Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com> Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
This was referenced Aug 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For oc/cgroups v0.0.9 release notes, see https://github.com/opencontainers/cgroups/releases/tag/v0.0.9