On 10/11/26 08:10, Rick Richard wrote:
There should be no need for this at all. The probe sequence should notice
conflicting addresses and adjust.
What's your failure case?
r~
You're right about that, but there's a less obvious case that falls
through the cracks: programs loaded through ld.so. qemu only loads
ld.so, so that's all the probe sees, and it picks guest_base 0. Then
ld.so maps the real program at its fixed address, right on top of qemu.
An easy way to hit it is ldd on FreeBSD. In an aarch64 jail with the
stock perl package:
# ldd /usr/local/bin/perl
/usr/local/bin/perl:
ld-elf.so.1: /usr/local/bin/perl: mmap of entire address space failed:
Cannot allocate memory
Mm, right.
FreeBSD can't link static PIE, so qemu-*-static is always linked at
0x200000.
That's unfortunate. We could explicitly link somewhere high in the
address space, perhaps. E.g.
-Wl,--image-base,0x80000000000
?
r~