Skip to content

[Refactor] Reduce runc-dmz binary size #4027

Closed
@lifubang

Description

@lifubang

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions