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

Alexander Potapenko glider at google.com
Fri Dec 9 22:21:53 PST 2011


On Sat, Dec 10, 2011 at 2:04 AM, Eric Christopher <echristo at apple.com> wrote:
>
> 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.
>
Am I understanding right -- you suggest to check for MH_PIE, and, if it is set:
  -- on Snow Leopard, check for DYLD_NO_PIE and exit with the error
message, if it is not set
  -- on Lion, set the flag disabling ASLR, fork and exec

I'm ok with such a suggestion



More information about the llvm-dev mailing list