[LLVMdev] AddressSanitizer flags in LLVM 3.5

Alexander Tarasikov alexander.tarasikov at gmail.com
Thu Sep 25 02:01:14 PDT 2014


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 and add a public documented option to control it? It
is also interesting that OS X and FreeBSD use larger offset.

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".

-- 
Regards, Alexander



More information about the llvm-dev mailing list