Skip to content

Copy go-systemd/activation.Files code to avoid bringing in crypto/tls#5057

Merged
kolyshkin merged 2 commits intoopencontainers:mainfrom
kolyshkin:sd-act
Dec 15, 2025
Merged

Copy go-systemd/activation.Files code to avoid bringing in crypto/tls#5057
kolyshkin merged 2 commits intoopencontainers:mainfrom
kolyshkin:sd-act

Conversation

@kolyshkin
Copy link
Copy Markdown
Contributor

@kolyshkin kolyshkin commented Dec 5, 2025

Inspired by PR #5056.

Closes: #5056.


Remove crypto/tls dependency
It appears that when we import github.com/coreos/go-systemd/activation,
it brings in the whole crypto/tls package (which is not used by runc
directly or indirectly), making the runc binary size larger and
potentially creating issues with FIPS compliance.

Let's copy the code of function we use from go-systemd/activation
to avoid that.

The space savings are:

$ size runc.before runc.after
   text	   data	    bss	    dec	    hex	filename
7101084	5049593	 271560	12422237	 bd8c5d	runc.before
6508796	4623281	 229128	11361205	 ad5bb5	runc.after

Reported-by: @xnox

@@ -51,7 +55,7 @@ func Files(unsetEnv bool) []*os.File {
}

nfds, err := strconv.Atoi(os.Getenv("LISTEN_FDS"))
if err != nil || nfds == 0 {
if err != nil || nfds <= 0 {
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.

Note: I used the latest version of this file; this change comes from coreos/go-systemd@de1b3a8

@cyphar cyphar changed the title Copy go-systemd/actvation.Files code to avoid brining in crypto/tls Copy go-systemd/activation.Files code to avoid brining in crypto/tls Dec 7, 2025
@cyphar cyphar changed the title Copy go-systemd/activation.Files code to avoid brining in crypto/tls Copy go-systemd/activation.Files code to avoid bringing in crypto/tls Dec 7, 2025
@cyphar
Copy link
Copy Markdown
Member

cyphar commented Dec 7, 2025

This is probably an even better solution than a build tag to be honest...

@cyphar
Copy link
Copy Markdown
Member

cyphar commented Dec 7, 2025

My only question is whether we should put this in internal/third_party/systemd to make the provenence more obvious.

It appears that when we import github.com/coreos/go-systemd/activation,
it brings in the whole crypto/tls package (which is not used by runc
directly or indirectly), making the runc binary size larger and
potentially creating issues with FIPS compliance.

Let's copy the code of function we use from go-systemd/activation
to avoid that.

The space savings are:

$ size runc.before runc.after
   text	   data	    bss	    dec	    hex	filename
7101084	5049593	 271560	12422237	 bd8c5d	runc.before
6508796	4623281	 229128	11361205	 ad5bb5	runc.after

Reported-by: Dimitri John Ledkov <dimitri.ledkov@surgut.co.uk>
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Remove unused code and argument from the ActivationFiles,
and simplify its usage.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
@kolyshkin
Copy link
Copy Markdown
Contributor Author

My only question is whether we should put this in internal/third_party/systemd to make the provenence more obvious.

implemented

@kolyshkin
Copy link
Copy Markdown
Contributor Author

Do we want this for 1.4.1?

@kolyshkin kolyshkin merged commit d978dd2 into opencontainers:main Dec 15, 2025
38 checks passed
@kolyshkin kolyshkin added the backport/1.4-done A PR in main branch which has been backported to release-1.4 label Jan 28, 2026
@kolyshkin
Copy link
Copy Markdown
Contributor Author

Do we want this for 1.4.1?

We do, due to a need for a clean backport of #5093 to release-1.4. Added this to #5094.

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

Labels

backport/1.4-done A PR in main branch which has been backported to release-1.4

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants