+llvmdev<div><br></div><div>Question to MacOS gurus: is there a way to disable ASLR (address space layout randomization) on Darwin at link time </div><div>instead of doing setenv("DYLD_NO_PIE", "1", 1); and reexec? </div>
<div><br></div><div>Thanks, </div><div><br></div><div>--kcc <br><br><div class="gmail_quote">On Fri, Dec 9, 2011 at 4:28 AM, Alexander Potapenko <span dir="ltr"><<a href="mailto:glider@google.com">glider@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">The attached patch introduces the disable_aslr option (off by default)<br>
and the corresponding AsanDisableAslr function that should disable the<br>
address space randomization.<br>
This is now implemented for Mac OS 10.6 only.<br>
In order to do this we add DYLD_NO_PIE=1 to the env and restart the program.<br>
<br>
Next steps to be done are:<br>
 -- check for MH_PIE bit -- if it is 0, we don't need to disable anything;<br>
 -- use posix_spawnattr_setflags() to set the _POSIX_SPAWN_DISABLE_ASLR on 10.7<br>
 -- disable ASLR on Linux, if needed.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Alexander Potapenko<br>
Software Engineer<br>
Google Moscow<br>
</font></span></blockquote></div><br></div>