Shi, Steven via llvm-dev
2017-Jul-21 01:46 UTC
[llvm-dev] Where does the LLVM implement the Ubsan's instrumentations?
Hello, I'm investigating on enabling the Ubsan in my firmware. I have two questions about Ubsan: 1. I see the Ubsan run-time lib functions are defined in http://llvm.org/svn/llvm-project/compiler-rt/trunk/lib/ubsan/ubsan_interface.inc, but I cannot find how the LLVM implement the Ubsan instrumentations. I see the Asan's instrumentation lib is in http://llvm.org/svn/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp, but where is the Ubsan instrumentation lib? 2. My firmware usage scenario is quite sensitive to the code size. Does the Ubsan have the build option to use callbacks instead of inline code for the Ubsan instrumentations (like Asan's -asan-instrumentation-with-call-threshold=0) ? Thanks Steven -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170721/207ec3fa/attachment.html>
John Regehr via llvm-dev
2017-Jul-21 01:55 UTC
[llvm-dev] Where does the LLVM implement the Ubsan's instrumentations?
Most of UBSan runs in the late parts of Clang, see the lib/CodeGen directory.> 2. My firmware usage scenario is quite sensitive to the code > size. Does the Ubsan have the build option to use callbacks instead of > inline code for the Ubsan instrumentations (like Asan's > -asan-instrumentation-with-call-threshold=0) ?I think your best bet for controlling code bloat is to compile with -fsanitize=undefined -fsanitize-trap=undefined. John
John Regehr via llvm-dev
2017-Jul-21 03:41 UTC
[llvm-dev] Where does the LLVM implement the Ubsan's instrumentations?
> I think your best bet for controlling code bloat is to compile with > -fsanitize=undefined -fsanitize-trap=undefined.Also you may not need all of UBSan's checks at the same time -- so pick and choose among its checks using the finer-grained flags. If you're really stuck against a hard limit on code size, try applying UBSan to a subset of files in your project at a time. John