[PATCH] [compiler-rt] Implement AddressSanitizer suppressions

Kuba Brecka kuba.brecka at gmail.com
Fri Nov 14 13:15:38 PST 2014


This patch adds a issue suppression mechanism into ASan, reusing most of the functionality from TSan and sanitizer_common. Based on recent discussions, being able to suppress reports coming from interceptors sounds like a good idea, especially to be able to keep using libraries that you don't have source code of. Reports coming from memory access instrumentation are not affected. This patch also depends on the refactorings from http://reviews.llvm.org/D6276.

What this patch does is that it introduces 3 new types of suppressions, while keeping the suppression file format the same as TSan (described at https://code.google.com/p/thread-sanitizer/wiki/Suppressions). The new types:

* `asan_interceptor:strcpy`	… will ignore any reports from the strcpy interceptor, no matter what function calls it
* `asan_function:myfunction` … will ignore any report where the function named `myfunction` is somewhere in the stack trace 
* `asan_library:mylibrary` … will ignore any report where module named `mylibrary` is somewhere in the stack trace

There’s no way to specify more than one frame, the suppressions match any frame in the call stack (except asan_interceptor, which only takes a look at the first frame in the call stack, which is the current interceptor). Also note that the `asan_library` suppression type doesn’t require the symbolizer to work.

The suppression file is set with the `suppressions=/path/to/file` option in ASAN_OPTIONS, the same way we allow this for TSan.

The patch contains a generic test case and a Darwin-specific testcase.

Related discussions:
* https://code.google.com/p/address-sanitizer/issues/detail?id=356
* https://groups.google.com/d/topic/address-sanitizer/M6jmTnYbRRY/discussion

http://reviews.llvm.org/D6280

Files:
  lib/asan/CMakeLists.txt
  lib/asan/asan_interceptors.cc
  lib/asan/asan_rtl.cc
  lib/asan/asan_suppressions.cc
  lib/asan/asan_suppressions.h
  lib/sanitizer_common/sanitizer_suppressions.cc
  lib/sanitizer_common/sanitizer_suppressions.h
  test/asan/TestCases/Darwin/suppressions-darwin.cc
  test/asan/TestCases/suppressions.cc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6280.16249.patch
Type: text/x-patch
Size: 9077 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141114/28c3400c/attachment.bin>


More information about the llvm-commits mailing list