runtime_loader incorrectly handles non-position-independent executables
|Reported by:||simonsouth||Owned by:||nobody|
runtime_loader uses address-space layout randomization for security and will randomly locate in memory any program segments that are relocatable, assuming executables will be position-independent by default.
However the test it uses for relocatability is unreliable: The presence of a dynamic section simply means the executable "participates in dynamic linking", which will be true for a fixed-position executable that relies on code in a shared library, for instance.
As a result runtime_loader will load fixed-position executables but randomly position their segments in memory anyway, causing a speedy crash.
Fixing runtime_loader's test for relocatability will allow it to support both position-independent and fixed-position executables without affecting Haiku's preference for position-independent code.
This change is required to build GNU Emacs and (I believe) gcc 5, which apparently expects to be able to produce fixed-position executables as part of its build process.
Change History (6)
by , 5 years ago