Skip to content

vendor: bump opencontainers/cgroups to v0.1.2 - #5623

Merged
AkihiroSuda merged 2 commits into
opencontainers:mainfrom
kolyshkin:cgroups-main
Nov 25, 2026
Merged

AkihiroSuda merged 2 commits into
opencontainers:mainfrom
kolyshkin:cgroups-main

Conversation

@kolyshkin

@kolyshkin kolyshkin commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

See

Notably, cgroups no longer depends on cilium/ebpf (opencontainers/cgroups#94) (and thus crypto),
except for unit tests. The benefits are:

Per the binary-size CI check (amd64):

bytes
before 7494176
after 6983968 (-510208, -6.8%)

The second commit adds make verify-forbidden-pkgs (run
in CI) to keep it that way; it also forbids regexp (see #3460). On failure, it shows
which packages import forbidden ones.
Also, add a CHANGELOG entry.

Fixes #5612.

@kolyshkin kolyshkin changed the title [DO NOT MERGE] vendor: bump opencontainers/cgroups to HEAD vendor: bump opencontainers/cgroups to v0.1.1 Nov 18, 2026
@kolyshkin
kolyshkin marked this pull request as ready for review November 18, 2026 20:12
@kolyshkin
kolyshkin force-pushed the cgroups-main branch 5 times, most recently from 9a41494 to 59f4af3 Compare November 18, 2026 21:42
Comment thread Makefile
Comment on lines +265 to +272
# Packages (and their subpackages) runc must not depend on (regex alternation):
# - crypto, golang.org/x/crypto: see #4916, #5612;
# - regexp: see #3460.
FORBIDDEN_PKGS := crypto|golang[.]org/x/crypto|regexp

# On failure, show which other packages import forbidden ones.
.PHONY: verify-forbidden-pkgs
verify-forbidden-pkgs:

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
Contributor Author

Choose a reason for hiding this comment

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

I have checked that before resorting to such crude methods. Alas, depguard only check direct dependencies while we need to also/mainly check the indirect ones. For example, crypto was pulled via oc/cgroups -> cilium/ebpf/asm. Similarly for regexp (there were a few direct users here and ~3 dependencies that wanted it).

OTOH go list -deps (provided the same build tags etc are used) walks the whole depgraph of runc binary.

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.

Ouch, and it seems go mod why also doesn't print this, right? If there is no other way, okay, at least it is CI :-D

It seems it doesn't list the cgroups --> cilium path. But it seems it is still imported by those? I'm a little confused :D

$ go mod why -vendor crypto
# crypto
github.com/opencontainers/runc/libcontainer/specconv
github.com/godbus/dbus/v5
crypto/sha1
crypto

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.

Looks like there's a proposal to add support in depguard, but doesn't look like it gained much traction so far;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@rata cilium/ebpf dependency is gone with oc/cgroups v0.1.1, it is only used by oc/cgroups test.

Ah! If you mean why cilium/ebpf is NOT listed in go mod why -vendor crypto I think it only lists one path, not all of them, and it builds graphs using all GOOS/GOARCH and all possible build tags. The crypto is used by godbus on windows.

So the only correct way (for now?) is using go list -deps which is what's done here.

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.

Can we just have depguard in both runc and cgroups repos?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@AkihiroSuda that is answered here, see #5623 (comment). TL;DR: depguard only checks direct dependencies, and here we need to check indirect ones.

@kolyshkin
kolyshkin requested a review from thaJeztah November 21, 2026 05:42
@lifubang lifubang mentioned this pull request Nov 23, 2026
@lifubang

Copy link
Copy Markdown
Member

There is a regression in v0.1.1: opencontainers/cgroups#102

Comment thread Makefile
# Packages (and their subpackages) runc must not depend on (regex alternation):
# - crypto, golang.org/x/crypto: see #4916, #5612;
# - regexp: see #3460.
FORBIDDEN_PKGS := crypto|golang[.]org/x/crypto|regexp

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.

Can we document why each package is forbidden briefly in a comment?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hmm, we already have that, just above this line (links to issues/PRs)

@kolyshkin kolyshkin added this to the 1.6.0 milestone Nov 23, 2026
@kolyshkin
kolyshkin marked this pull request as draft November 25, 2026 19:53
@kolyshkin

Copy link
Copy Markdown
Contributor Author

Draft waiting for oc/cgroups v0.1.2 (to include opencontainers/cgroups#103).

@kolyshkin kolyshkin changed the title vendor: bump opencontainers/cgroups to v0.1.1 vendor: bump opencontainers/cgroups to v0.1.2 Nov 25, 2026
See https://github.com/opencontainers/cgroups/releases/tag/v0.1.1
and https://github.com/opencontainers/cgroups/releases/tag/v0.1.2

Notably, cgroups no longer depends on cilium/ebpf, so it is dropped
from go.mod and vendor, making the runc binary about 500 KB (6.8%)
smaller on amd64.

This also removes the last crypto package (crypto/sha1, used by
cilium/ebpf/asm) from runc dependencies. With some Go builds (e.g.
Microsoft Go) crypto packages make the Go runtime dlopen libcrypto.so
on startup, by which time runc init is already in the container's mount
namespace, so exec fails if the container image lacks libcrypto.so.

Fixes opencontainers#5612.

Assisted-by: Claude Opus 5.5
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Add a check that runc does not depend on certain packages (and their
subpackages), listed in FORBIDDEN_PKGS. On failure, the check shows
which other packages import forbidden ones.

The initial list is:

 - crypto (from either Go standard library or golang.org/x/crypto).
   runc does not need it, and, since switching to opencontainers/cgroups
   v0.1.1, it no longer depends on any. With some Go builds (e.g.
   Microsoft Go) crypto packages make the Go runtime dlopen libcrypto.so
   on startup, which breaks runc init in containers without libcrypto.so
   (see opencontainers#4916, opencontainers#5612).

 - regexp. It is big and slow, and runc does without it since opencontainers#3460.

Assisted-by: Claude Opus 5.5
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin
kolyshkin marked this pull request as ready for review November 25, 2026 20:54
@kolyshkin
kolyshkin requested review from a team and AkihiroSuda November 25, 2026 20:56

@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

@AkihiroSuda
AkihiroSuda added this pull request to the merge queue Nov 25, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 25, 2026
@AkihiroSuda
AkihiroSuda added this pull request to the merge queue Nov 25, 2026
Merged via the queue into opencontainers:main with commit 6d20d9c Nov 25, 2026
97 of 98 checks passed
@lifubang

Copy link
Copy Markdown
Member

Maybe we need to backport to release-1.5?

@lifubang lifubang added the backport/1.5-todo A PR in main branch which needs to be backported to release-1.5 label Nov 26, 2026
@lifubang

Copy link
Copy Markdown
Member

Maybe we need to backport to release-1.5?

I mean this commit: d093491

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.

Remove the last crypto package from the runc binary

5 participants