[LLVMdev] AddressSanitizer flags in LLVM 3.5
Kostya Serebryany
kcc at google.com
Thu Sep 25 18:33:13 PDT 2014
On Thu, Sep 25, 2014 at 2:01 AM, Alexander Tarasikov <
alexander.tarasikov at gmail.com> wrote:
> Hello, LLVM developers
>
> I would like to ask about the changes in the "nonpublic"
> AddressSanitizer flags in llvm 3.5.
>
> Prior to 3.5 (namely, on 3.4.2) there was a compile-time flag to
> control the shadow offset. For example, one could do the following to
> force the large offset:
> -mllvm -asan-mapping-offset-log=44
>
> Now, it has been removed and on x86_64 linux the smaller offset is always
> used.
>
> Our use case for the large offset was using NVIDIA OpenGL/CUDA drivers
> which apparently mmap certain memory ranges and fail when the
> requested address does not match the return value of mmap. Using a
> larger offset allows to work around the problem and use both the
> binary driver and ASan which is very useful.
>
> Could someone explain the reason behind forcing a small shadow offset
> on 64-bit linux
The reason is performance and code size -- both get better by 3%-5% with
the small offset.
> and add a public documented option to control it?
Oh my... This is not as trivial as it sounds.
We removed this option because (as we thought) no one was using it and
because it was actually hard to maintain.
This is a compile-time option, which uses a different ABI, and objects
built with different flags are incompatible.
GCC variant of asan does not support it either and GCC folks explicitly
said that they are not going to.
I don't have a good solution. Others?
In the meantime I would strongly suggest to try fixing the issue on the
NVIDIA side.
It
> is also interesting that OS X and FreeBSD use larger offset.
>
Right. The small offset didn't work there for some reasons...
>
> Meanwhile, those who are interested in using ASan and NVIDIA, can edit
> "lib/Transforms/Instrumentation/AddressSanitizer.cpp" and replace
> "Mapping.Offset = kSmallX86_64ShadowOffset" with "Mapping.Offset =
> kDefaultShadowOffset64".
>
you will also need to change the run-time library.
--kcc
>
> --
> Regards, Alexander
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140925/1ae00e28/attachment.html>
More information about the llvm-dev
mailing list