<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 25, 2014 at 2:01 AM, Alexander Tarasikov <span dir="ltr"><<a href="mailto:alexander.tarasikov@gmail.com" target="_blank">alexander.tarasikov@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello, LLVM developers<br>
<br>
I would like to ask about the changes in the "nonpublic"<br>
AddressSanitizer flags in llvm 3.5.<br>
<br>
Prior to 3.5 (namely, on 3.4.2) there was a compile-time flag to<br>
control the shadow offset. For example, one could do the following to<br>
force the large offset:<br>
-mllvm -asan-mapping-offset-log=44<br>
<br>
Now, it has been removed and on x86_64 linux the smaller offset is always used.<br>
<br>
Our use case for the large offset was using NVIDIA OpenGL/CUDA drivers<br>
which apparently mmap certain memory ranges and fail when the<br>
requested address does not match the return value of mmap. Using a<br>
larger offset allows to work around the problem and use both the<br>
binary driver and ASan which is very useful.<br>
<br>
Could someone explain the reason behind forcing a small shadow offset<br>
on 64-bit linux</blockquote><div><br></div><div>The reason is performance and code size -- both get better by 3%-5% with the small offset. </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> and add a public documented option to control it?</blockquote><div><br></div><div>Oh my... This is not as trivial as it sounds. </div><div>We removed this option because (as we thought) no one was using it and because it was actually hard to maintain. </div><div>This is a compile-time option, which uses a different ABI, and objects built with different flags are incompatible. </div><div>GCC variant of asan does not support it either and GCC folks explicitly said that they are not going to. </div><div><br></div><div>I don't have a good solution. Others? </div><div>In the meantime I would strongly suggest to try fixing the issue on the NVIDIA side. </div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> It<br>
is also interesting that OS X and FreeBSD use larger offset.<br></blockquote><div><br></div><div><br></div><div>Right. The small offset didn't work there for some reasons... </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Meanwhile, those who are interested in using ASan and NVIDIA, can edit<br>
"lib/Transforms/Instrumentation/AddressSanitizer.cpp" and replace<br>
"Mapping.Offset = kSmallX86_64ShadowOffset" with "Mapping.Offset =<br>
kDefaultShadowOffset64".<br></blockquote><div>you will also need to change the run-time library. </div><div><br></div><div>--kcc </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Regards, Alexander<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">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>
</font></span></blockquote></div><br></div></div>