Description
Is this a bug report, feature (enhancement) request or question? (leave only one on its own line)
/kind enhancement
Description:
qemu-user-static can now automatically handle binfmt P mode for reflecting the correct argv[0]
value, based on the name of the binary (a suffix -binfmt-P
). I have a manually hacked container to do exactly this; looking into fixing it here but have to familiarize myself with this container's build automation.
Since this can now be automatic, it probably should be the default mode once implemented. There's really no reason not to use binfmt P mode if it can be used, because non-P mode is seriously buggy in many contexts.
This is fairly simple to do, if someone with more familiarity with this container's build wants to give it a go:
- Rename the binaries from
qemu-ARCH-static
toqemu-ARCH-static-binfmt-P
- Copy those binaries into the container, with that renaming.
- Change the last line of
register.sh
from:
exec /qemu-binfmt-conf.sh --qemu-suffix "-static" --qemu-path "${QEMU_BIN_DIR}" $@
to:
exec /qemu-binfmt-conf.sh --qemu-suffix "-static-binfmt-P" --preserve-argv0 yes --qemu-path "${QEMU_BIN_DIR}" $@
Once done, argv[0]
will be correct in the foreign container environment. No wrapper C program needed.
Environment:
- QEMU version: (if you can know it): 7.2.0
- Container application: Docker
Output of docker version
, podman version
or singularity version
Client:
Version: 20.10.12
API version: 1.41
Go version: go1.17.3
Git commit: 20.10.12-0ubuntu4
Built: Mon Mar 7 17:10:06 2022
OS/Arch: linux/amd64
Context: default
Experimental: true