[klibc] Bug#1040981: klibc-utils: segfault executing armhf binaries under qemu-user
tg at debian.org
Fri Jul 14 13:07:06 PDT 2023
Michael Tokarev dixit:
> commit 6fd5944980f4ccee728ce34bdaffc117db50b34d
>From the comment, it reserves 16 MiB after the main executable.
In klibc/armhf, however, the main executable starts around
0x00010000 whereas the interpreter starts after that, around
Perhaps the fix here would be to see if the interpreter comes
within 16 MiB past the main executable’s end, and if so, to
move the break (I wasn’t aware stuff on GNU/Linux still uses
that!) to start after the interpreter instead.
The BSD manpage begins with…
The brk() and sbrk() functions are historical curiosities left over from
earlier days before the advent of virtual memory management.
… so… oh well.
Anyway, while my proposed fix in theory moves the “end of the
process’ data segment” to behind the interpreter instead of
behind the main executable, processes are not supposed to use
it in combination with _end, only the returned pointers. It’s
something to at least consider. Will you forward this upstream?
Given how this both constraints executables’ sizes and perhaps
has effects on other loaders, perhaps the klibc upstream could
consider switching to using linker scripts or at least move the
respective text basēs, on all architectures, so that the main
executable comes after the interpreter.
This will of course not help bookworm users but, perhaps, it is
something, again, to consider, at least.
This space for rent.
https://paypal.me/mirabilos to support my work.
More information about the klibc