Repository navigation
vendor: bump opencontainers/cgroups to v0.1.2 - #5623
Conversation
78e5127 to
b34f10e
Compare
9a41494 to
59f4af3
Compare
| # 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: |
There was a problem hiding this comment.
Curious, can't we use the forbidigo or depguard linters for this?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Looks like there's a proposal to add support in depguard, but doesn't look like it gained much traction so far;
There was a problem hiding this comment.
@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.
There was a problem hiding this comment.
Can we just have depguard in both runc and cgroups repos?
There was a problem hiding this comment.
@AkihiroSuda that is answered here, see #5623 (comment). TL;DR: depguard only checks direct dependencies, and here we need to check indirect ones.
|
There is a regression in |
| # 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 |
There was a problem hiding this comment.
Can we document why each package is forbidden briefly in a comment?
There was a problem hiding this comment.
Hmm, we already have that, just above this line (links to issues/PRs)
|
Draft waiting for oc/cgroups v0.1.2 (to include opencontainers/cgroups#103). |
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>
59f4af3 to
6c6e488
Compare
6d20d9c
|
Maybe we need to backport to |
I mean this commit: d093491 |
See
Notably, cgroups no longer depends on
cilium/ebpf(opencontainers/cgroups#94) (and thuscrypto),except for unit tests. The benefits are:
Per the binary-size CI check (amd64):
The second commit adds
make verify-forbidden-pkgs(runin CI) to keep it that way; it also forbids
regexp(see #3460). On failure, it showswhich packages import forbidden ones.
Also, add a CHANGELOG entry.
Fixes #5612.