utils/genrandconfig: reject qemu user mode on hosts with large pages
PATCH 1/1 utils/genrandconfig: reject qemu user mode on hosts with large pages
Qemu in user mode cannot load target binaries laid out for 4k pages when the host uses larger pages, as the 16k pages of the Asahi Linux kernel on Apple Silicon. The dynamic loader then fails with e.g.:
GLib-2.0: error while loading shared libraries: libz.so.1: failed to map segment from shared object
or, depending on the target:
qemu-aarch64: .../GLib-2.0: Error mapping file: Invalid argument
torque: error while loading shared libraries: libz.so.1: ELF load command address/offset not page-aligned
This hits every package running target code through qemu at build time, i.e. gobject-introspection and nodejs, on mips, sparc64 and aarch64 alike, and is not something Buildroot can fix in the packages themselves.
As this only depends on the build host, reject such configurations in genrandconfig when the host page size is larger than 4k.
Fixes:
https://autobuild.buildroot.org/results/4848e735fe83dfeef4f24d32655c567951fd113a (mips)
https://autobuild.buildroot.org/results/089ddac5bdaaf5650cbc5c26d48952b5bede0ca6 (sparc64)
https://autobuild.buildroot.org/results/c30c6719a0350370ebe3cfe262123727f4057734 (aarch64)
--- utils/genrandconfig | 7 +++++++ 1 file changed, 7 insertions(+)
utils/genrandconfig +7 -0
@@ -124,6 +124,13 @@ async def fixup_config(sysinfo, configfile): if 'BR2_PACKAGE_LIBOPENSSL=y\n' in configlines and \ 'BR2_TOOLCHAIN_HAS_ATOMIC=y\n' not in configlines: return False + # Qemu in user mode cannot load target binaries laid out for 4k + # pages on a host with larger pages (e.g. 16k on Apple Silicon), + # so packages running target code at build time (gobject- + # introspection, nodejs) fail there. + if 'BR2_PACKAGE_HOST_QEMU_LINUX_USER_MODE=y\n' in configlines and \ + os.sysconf('SC_PAGE_SIZE') > 4096: + return False if 'BR2_PACKAGE_SUNXI_BOARDS=y\n' in configlines: configlines.remove('BR2_PACKAGE_SUNXI_BOARDS_FEX_FILE=""\n') configlines.append('BR2_PACKAGE_SUNXI_BOARDS_FEX_FILE="a10/hackberry.fex"\n')
Signature · 6 lines
2.34.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Thomas Petazzoni via buildroot
AppliedQuoted 21 lines · Yegor Yefremov via buildroot
Qemu in user mode cannot load target binaries laid out for 4k pages when the host uses larger pages, as the 16k pages of the Asahi Linux kernel on Apple Silicon. The dynamic loader then fails with e.g.:
GLib-2.0: error while loading shared libraries: libz.so.1: failed to map segment from shared object
or, depending on the target:
qemu-aarch64: .../GLib-2.0: Error mapping file: Invalid argument
torque: error while loading shared libraries: libz.so.1: ELF load command address/offset not page-alignedThis hits every package running target code through qemu at build time, i.e. gobject-introspection and nodejs, on mips, sparc64 and aarch64 alike, and is not something Buildroot can fix in the packages themselves.
As this only depends on the build host, reject such configurations in genrandconfig when the host page size is larger than 4k.
Quoted 7 lines
Fixes:
https://autobuild.buildroot.org/results/4848e735fe83dfeef4f24d32655c567951fd113a (mips)
https://autobuild.buildroot.org/results/089ddac5bdaaf5650cbc5c26d48952b5bede0ca6 (sparc64)
https://autobuild.buildroot.org/results/c30c6719a0350370ebe3cfe262123727f4057734 (aarch64)Signed-off-by Yegor Yefremov <[email protected]>Assisted-by Claude:claude-opus-5-5
Applied to master, thanks!
Best regards,
Thomas Petazzoni
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Raphaël Mélotte via buildroot
AppliedIn reply of:
Quoted 21 lines
Qemu in user mode cannot load target binaries laid out for 4k pages when the host uses larger pages, as the 16k pages of the Asahi Linux kernel on Apple Silicon. The dynamic loader then fails with e.g.:
GLib-2.0: error while loading shared libraries: libz.so.1: failed to map segment from shared object
or, depending on the target:
qemu-aarch64: .../GLib-2.0: Error mapping file: Invalid argument
torque: error while loading shared libraries: libz.so.1: ELF load command address/offset not page-alignedThis hits every package running target code through qemu at build time, i.e. gobject-introspection and nodejs, on mips, sparc64 and aarch64 alike, and is not something Buildroot can fix in the packages themselves.
As this only depends on the build host, reject such configurations in genrandconfig when the host page size is larger than 4k.
Quoted 7 lines
Fixes:
https://autobuild.buildroot.org/results/4848e735fe83dfeef4f24d32655c567951fd113a (mips)
https://autobuild.buildroot.org/results/089ddac5bdaaf5650cbc5c26d48952b5bede0ca6 (sparc64)
https://autobuild.buildroot.org/results/c30c6719a0350370ebe3cfe262123727f4057734 (aarch64)Signed-off-by Yegor Yefremov <[email protected]>Assisted-by Claude:claude-opus-5-5
Applied to 2025.02.x, 2026.08.x. Thanks
Quoted 12 lines
--- utils/genrandconfig | 7 +++++++ 1 file changed, 7 insertions(+)utils/genrandconfig +0
-0@@ -124,6 +124,13 @@ async def fixup_config(sysinfo, configfile): if 'BR2_PACKAGE_LIBOPENSSL=y\n' in configlines and \ 'BR2_TOOLCHAIN_HAS_ATOMIC=y\n' not in configlines: return False
utils/genrandconfig async def fixup_config(sysinfo, configfile): · line 136
Quoted 10 lines
utils/genrandconfig +7
-0+ # Qemu in user mode cannot load target binaries laid out for 4k + # pages on a host with larger pages (e.g. 16k on Apple Silicon), + # so packages running target code at build time (gobject- + # introspection, nodejs) fail there. + if 'BR2_PACKAGE_HOST_QEMU_LINUX_USER_MODE=y\n' in configlines and \ + os.sysconf('SC_PAGE_SIZE') > 4096: + return False if 'BR2_PACKAGE_SUNXI_BOARDS=y\n' in configlines: configlines.remove('BR2_PACKAGE_SUNXI_BOARDS_FEX_FILE=""\n') configlines.append('BR2_PACKAGE_SUNXI_BOARDS_FEX_FILE="a10/hackberry.fex"\n')
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot