Repository navigation
fix(runc): backport upstream fixes to build without Go crypto - #19869
Muhammad Falak R Wani (mfrw) wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🔵 Needs a closer look
The security-sensitive eBPF encoder requires human verification of supported-architecture RPM builds, privileged cgroup-v2 allow/deny tests, and runc exec without libcrypto using default Microsoft Go, which this review environment cannot perform.
No open issues 🎉
What changed in this PR
This PR changes Azure Linux’s runc packaging to avoid Go crypto dependencies while retaining the default Microsoft Go crypto backend, addressing startup failures in containers without libcrypto.so.
Changes:
- Backports go-selinux’s switch to
math/rand/v2and replaces cilium’s device-filter assembler with a local encoder. - Removes the systemcrypto opt-out and adds a build-time check for linked Go crypto packages.
- Applies vendor patches after unpacking vendor sources and refreshes the lock and rendered packaging files.
| File | Description |
|---|---|
specs/r/runc/runc.spec |
Updates patch application, crypto guard, release, and changelog. |
specs/r/runc/0002-vendor-opencontainers-cgroups-encode-device-filter.patch |
Rendered patch introducing the local device-filter encoder. |
specs/r/runc/0001-vendor-go-selinux-use-math-rand-v2.patch |
Rendered SELinux random-number backport. |
locks/runc.lock |
Refreshes the component input fingerprint. |
base/comps/runc/overlays/0001-disable-ms-go-systemcrypto.overlay.toml |
Removes the previous crypto-backend opt-out. |
base/comps/runc/overlays/0001-build-runc-without-go-crypto.overlay.toml |
Registers vendor patches and the crypto-linkage guard. |
base/comps/runc/0002-vendor-opencontainers-cgroups-encode-device-filter.patch |
Replaces cilium assembly with local instruction encoding. |
base/comps/runc/0001-vendor-go-selinux-use-math-rand-v2.patch |
Replaces vendored SELinux’s crypto/rand dependency. |
Review effort: Balanced
There was a problem hiding this comment.
Marking this as draft while we discuss the RFC.
There are at least two paths I see:
- See if upstream runc already has plans to remove
cryptopackages. If so, the path this PR is taking could be offered - The issue itself is that Go runtime starts after
runc inithas entered the container mount namespace, so the container's filesystem is referenced when Go is configured to use systemcrypto. This path would be to make Go look at the host's filesystem, which arguably should be used. This path should also be discussed with therunccommunity to gauge interest
runc init enters the container's mount namespace before the Go runtime starts, so the Microsoft Go systemcrypto backend dlopens libcrypto.so from the container rootfs, and every exec into an image without it fails (opencontainers/runc#4916). Azure Linux has worked around this by building runc with MS_GO_NOSYSTEMCRYPTO=1, which opts runc out of the default crypto backend. runc performs no cryptography. In 1.5.2 its only Go crypto imports come from two vendored helpers that runc never calls, and upstream has removed both: - go-selinux: use math/rand/v2 rather than crypto/rand (opencontainers/selinux 9a2bcdd5c41a, released in v1.14.0) - cgroups: drop the cilium/ebpf/asm dependency, which imports crypto/sha1 (opencontainers/cgroups d652a099305c, merged on 2026-11-18 as cgroups#94 and not yet released) Backport both to the vendored sources so runc links no Go crypto, drop the MS_GO_NOSYSTEMCRYPTO opt-out, and fail the build if a future runc update links Go crypto again. The backports can go once runc vendors go-selinux v1.14.0 or later and a cgroups release with d652a099305c. Signed-off-by: Muhammad Falak R Wani <falakreyaz@gmail.com>
80049dd to
24bec5e
Compare
I did create an Issue there and the upstream community accepted the proposal. |
|
/azp run |
|
Azure Pipelines: 2 pipeline(s) were filtered out due to trigger conditions. |
Summary
runc initenters the container's mount namespace before the Go runtime starts, so the Microsoft Go systemcrypto backend dlopenslibcrypto.sofrom the container rootfs. Everyexecinto an image without it fails (opencontainers/runc#4916). 4.0 works around this by building runc withMS_GO_NOSYSTEMCRYPTO=1, which opts runc out of the default crypto backend.runc performs no cryptography. In 1.5.2 its only Go crypto imports come from two vendored helpers that runc never calls, and upstream has removed both:
math/rand/v2rather thancrypto/randcilium/ebpf/asmdependency, which importscrypto/sha1This PR backports both to the vendored sources, so runc links no Go crypto. It drops the
MS_GO_NOSYSTEMCRYPTOopt-out and fails the build if a future runc update links Go crypto again. Because runc no longer links any Go crypto, the Go runtime never needslibcrypto.soinside the container, so the other option raised in review (having it look at the host filesystem instead) isn't needed. The backports can go once runc vendors go-selinux v1.14.0 or later and a cgroups release that includes d652a099305c.Changes
base/comps/runc/overlays/0001-backport-upstream-no-crypto.overlay.toml(upstream-backport): adds the two vendor patches and applies them after the vendor tarball is unpacked (%goprep -A, then%autopatch -p1).0001-vendor-go-selinux-use-math-rand-v2.patch: the upstream go-selinux commit, limited to the vendoredselinux_linux.go.0002-vendor-cgroups-devices-drop-cilium-ebpf-asm-dependency.patch: the upstream cgroups commit, with paths undervendor/. The test hunk is dropped because the vendored tree has no tests. The resultingdevicefilter.goandebpf_linux.goare byte-identical to upstream.base/comps/runc/overlays/0002-fail-build-on-go-crypto.overlay.toml(azl-security-compliance):%buildfails ifgo tool nmfinds any Go crypto package in the runc binary.0001-disable-ms-go-systemcrypto.overlay.toml, so runc builds with the default Azure Linux Go configuration. Lock refreshed and spec re-rendered: runc 2:1.5.2-6.Testing
azldev comp build(aarch64) ofrunc: success.%checkpassed (13 Go packages, 0 failures), and so did the new no-crypto check.Binary: no Go crypto symbols (1.5.2-5 has 207) and no reference to
libcrypto.so.cilium/ebpfis no longer linked,go version -mno longer showsGOEXPERIMENT=nosystemcrypto, and the binary is 4.9% smaller.Containers on cgroup v2 (Fedora 43 VM), busybox rootfs without libcrypto:
runexecprocReady not received,opensslcrypto: can't initialize OpenSSL libcrypto.so/dev/zeroallowed, host disk denied (EPERM)/dev/zeroallowed, host disk denied (EPERM)azldev comp updateandcomp renderare idempotent on the committed state; the commit message matches the commitizen schema; editorconfig-checker passes on the changed files.