Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Refactor] Reduce runc-dmz binary size #4027

Closed
lifubang opened this issue Sep 25, 2023 · 2 comments
Closed

[Refactor] Reduce runc-dmz binary size #4027

lifubang opened this issue Sep 25, 2023 · 2 comments

Comments

@lifubang
Copy link
Member

Now, the size of runc-dmz binary is more than 700kb, there is a sapce to reduce its size to reduce more memory when the container starting.
There are to ways could be considered:

  1. try to remove libc dependency.
  2. use asm

I guess we can optimize the binary footprint by eliminating glibc and executing “syscall” instruction directly, but that may happen in follow-up PRs
Rewriting this in asm will be much easier than complicating libc dependency
original posted by @AkihiroSuda
#3983 (comment)

The kernel's nolibc can be easily used and produces a very small binary. It seems only ppc is not supported, so we can fallback to stdlib in that case. We can just vendor it and no need to have anything installed on the distro building it.
A quick test shows that the binary can be 8K:
original posted by @rata
#3987 (comment)

https://gist.github.com/Zheaoli/f37bc1fb04917fdfac36d644ee69f7e9
I made a demo for amd64. The binary file size is 4.9k.
original posted by @Zheaoli
#3983 (comment)

Here is my contribution for arm64:
original posted by @eiffel-fl
#3983 (comment)

@cyphar
Copy link
Member

cyphar commented Sep 26, 2023

This is fixed with #4024. With nolibc, runc-dmz is 4.7kB on my machine.

@cyphar cyphar closed this as completed Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants