Package: qemu-user-static
Version: 1:7.2+dfsg-7+deb12u2
Followup-For: Bug #1053101

After building without `--disable-pie` and observing differences and
results I suspect the cause is something that is so obvious I missed it!

The emulator - when totally static - maps to 0x00040000 itself. Then in
the target ld-linux-aarch64.so.1 tries to map a static aarch64
executable to the same address (0x00040000) and since qemu doesn't
translate that in any way (could it?) the SIGSEGV occurs because the
emulator (qemu-aarch64-static) already uses that address.

However... the mmap() documentation suggests it should return -1 and set
errno and I'd expect that to be EEXIST MAP_FIXED_NOREPLACE.

However #2... those same docs state SIGSEGV when "Attempted write into a
region mapped as read-only" and that does make sense if the emulator's
.text is mapped there (presumably as PROT_EXEC|PROT_READ and
MAP_DENYWRITE).

Reply via email to