Yes, we have no ASRL with -no_pie. <div>Can we disable ASRL even with -pie? </div><div>On linux we can do it with "setarch x86_64 -R".</div><div><br></div><div>Another question: if asan would require -no_pie on Mac, will this be a serious limitation? </div>
<div><br></div><div>Thanks, </div><div><br></div><div>--kcc </div><div><br><div class="gmail_quote">On Fri, Dec 9, 2011 at 11:07 AM, Eric Christopher <span dir="ltr"><<a href="mailto:echristo@apple.com">echristo@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div style="word-wrap:break-word"><div>   Options when creating a main executable</div><div>     -pie        This makes a special kind of main executable that is position</div>
<div>                 independent (PIE).  On Mac OS X 10.5 and later, the OS the OS</div><div>                 will load a PIE at a random address each time it is executed.</div><div>                 You cannot create a PIE from .o files compiled with -mdy-</div>
<div>                 namic-no-pic.  That means the codegen is less optimal, but</div><div>                 the address randomization adds some security. When targeting</div><div>                 Mac OS X 10.7 or later PIE is the default for main executa-</div>
<div>                 bles.</div><div><br></div><div>     -no_pie     Do not make a position independent executable (PIE).  This is</div><div>                 the default, when targeting 10.6 and earlier.</div><div><br></div>
<div><div><div class="h5"><div>On Dec 9, 2011, at 11:02 AM, Kostya Serebryany wrote:</div><br></div></div><blockquote type="cite"><div><div class="h5">+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" target="_blank">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><font color="#888888"><br>
--<br>
Alexander Potapenko<br>
Software Engineer<br>
Google Moscow<br>
</font></span></blockquote></div><br></div></div></div>
_______________________________________________<br>LLVM Developers mailing list<br><a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br></blockquote></div><br></div></blockquote></div><br></div>