[LLVMdev] [PATCH] Add the disable_aslr option that will disable the address space layout randomization under AddressSanitizer on 10.6

Eric Christopher echristo at apple.com
Fri Dec 9 14:04:34 PST 2011

On Dec 9, 2011, at 11:46 AM, Alexander Potapenko wrote:

>> Link time is of course better.
>> But if there is a syscall (like the one used by setarch) we could call it
>> and reexec.
>> Using setenv("DYLD_NO_PIE")+reexec looks gross to me.
> There's posix_spawnattr_setflags() that can do the job
> (http://reverse.put.as/2011/08/11/how-gdb-disables-aslr-in-mac-os-x-lion/),
> but the necessary flag appeared only in Lion.
> To the best of my knowledge, there's no link-time option that disables
> ASLR but keeps PIE on Snow Leopard or Lion.
> At the moment we're using DYLD_NO_PIE with Chromium binaries to
> disable ASLR at runtime.

One bit that may make sense is to support the newest (Lion) style and give
a descriptive error message for the other two cases? I.e. if we notice that
MH_PIE is set in the executable, but we're not on Lion and we don't have
DYLD_NO_PIE set in the environment give an error?

Or some combination of this.


More information about the llvm-dev mailing list