JamiKettunen / void-bootstrap

Easily customize & create Void Linux rootfs images
BSD 2-Clause "Simplified" License
6 stars 3 forks source link

setup.sh: QEMU 8.x segfaults when running sed to switch mirror #1

Closed JamiKettunen closed 11 months ago

JamiKettunen commented 1 year ago

This can be reproduced by simply running the mkrootfs.sh in this repo without any special configuration as long as the qemu-aarch64{,-static} --version is 8.0.x so far (Arch, Alpine, Chimera Linux) which eventually calls https://github.com/JamiKettunen/void-bootstrap/blob/1dbda2e/setup.sh.in#L45:

$ ./mkrootfs.sh
...
>> Running stage1 rootfs setup...
(rootfs) >> Switching default package mirror to 'https://alpha.de.repo.voidlinux.org'...
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
./mkrootfs.sh: line 352: 26434 Segmentation fault      $sudo $chroot "$rootfs_dir" "$@"

v7.1.0 isn't affected which Void Linux for example currently ships, but upgrading the package locally (from https://github.com/void-linux/void-packages/pull/44822) brings the same behavior there.

Some new revelations: glibc rootfs doesn't appear affected by this at all while musl is, and I cannot reproduce this on either Chimera or Alpine which both use musl v1.2.4 while Void has v1.1.24 still with a bunch of patches from v1.2.x already.

v8.0.3 which just released a few days back doesn't change anything; the QEMU side origin of the segfaults is https://gitlab.com/qemu-project/qemu/-/commit/86f04735ac2088d5c069c3d1712212ec7428c562.

JamiKettunen commented 1 year ago

https://gitlab.com/qemu-project/qemu/-/commit/d28b3c90 (linux-user: Make sure initial brk(0) is page-aligned) solves this and should appear in a v8.0.4 / v8.1.0

JamiKettunen commented 1 year ago

"mitigated" a bit by defaulting to glibc instead of musl in https://github.com/JamiKettunen/void-bootstrap/commit/657e8da9e7724b4f39950d0d45035f35a80f92ab, may be reverted afterwards when resolved in a future QEMU release again and that has rolled out to affected relevant distros.

JamiKettunen commented 11 months ago

Reverted temporary default to glibc with 61f2ff0f997d5e51f05938f31789f6954243f85f, I don't think there's much more to do here so closing.