Skip to content

Bump oc/cgroups to v0.0.9, improve sub-cgroup checks - #5403

Open
kolyshkin wants to merge 2 commits into
opencontainers:mainfrom
kolyshkin:cgroups009
Open

Bump oc/cgroups to v0.0.9, improve sub-cgroup checks#5403
kolyshkin wants to merge 2 commits into
opencontainers:mainfrom
kolyshkin:cgroups009

Conversation

@kolyshkin

Copy link
Copy Markdown
Contributor

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>
@kolyshkin kolyshkin added the backport/1.5-todo A PR in main branch which needs to be backported to release-1.5 label Aug 14, 2026
@kolyshkin kolyshkin added this to the 1.6.0-rc.1 milestone Aug 14, 2026
@kolyshkin

Copy link
Copy Markdown
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>

@thaJeztah thaJeztah left a comment

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.

LGTM

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

Labels

backport/1.5-todo A PR in main branch which needs to be backported to release-1.5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants