Skip to content

Commit 1305765

Browse files
committed
build: make runc binary 7.6% smaller
In general runc does not do any cryptography or TLS networking. go-systemd module has optional support for TLS. It is compiled by default, and pulls in all of crypto/tls stack into the binary. Despite being unused, it is not optimised out, as there is no sophisticated LTO-like functionality in go toolchain. By removing this single file from the vendored modules, runc binary size is 7.6% smaller (both stripped and unstripped). This also has a nice compliance side effect - the only other cryptography modules pulled in are crypto/rand and crypto/sha1 neither of which are used to protect information at rest or in-transit, meaning the same build of runc can be used in FIPS and non-FIPS contexts, as not using any cryptography make the binary out of scope for FIPS cryptographic module compliance. If this is of interest, will also proposed to go-systemd project to add a build tag, to allow building go-systemd without tls-listeners. Signed-off-by: Dimitri John Ledkov <[email protected]>
1 parent e0adafb commit 1305765

File tree

2 files changed

+4
-103
lines changed

2 files changed

+4
-103
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,10 @@ localshfmt:
231231
vendor:
232232
$(GO) mod tidy
233233
$(GO) mod vendor
234+
rm vendor/github.com/coreos/go-systemd/v22/activation/listeners.go
235+
# Verify that no encryption/decryption cryptography is used
236+
git add vendor/
237+
[ -z $$(git grep -h '"crypto/' | grep -v -e 'crypto/sha1' -e 'crypto/rand') ]
234238
$(GO) mod verify
235239

236240
.PHONY: verify-changelog

vendor/github.com/coreos/go-systemd/v22/activation/listeners.go

Lines changed: 0 additions & 103 deletions
This file was deleted.

0 commit comments

Comments
 (0)