cd32ac13
by Yuxuan Shui at 2026-05-11T14:50:36+02:00
preloader: Account for ld.so stack usage when reserving.
preloader will skip reserving a memory regioning if it overlaps with the
arguments. Because the stack grows downwards from the arguments, the
reserve region would have overlapped the stack had it not been skipped.
Problem is, this check does not account for the stack usage of ld.so.
Some ld.so functions such as [1] has relatively big stack frames. If the
arguments array is *just* above a reserve region, the overlap check will
pass, the region will be reserved. Then after the control flow has been
passed to ld.so, it will crash after the stack frame grows into the
reservation.
[1]: https://elixir.bootlin.com/glibc/glibc-2.43.9000/source/elf/rtld.c#L855