[PATCH] [compiler-rt] Implement AddressSanitizer suppressions

Kuba Brecka kuba.brecka at gmail.com
Sun Nov 23 20:55:04 PST 2014


Second take on AddressSanitizer issue suppressions.

This time:
* The suppression types are renamed to `interceptor_name`, `interceptor_via_function` and `interceptor_via_library` to make it clear that they only affect interceptors.
* We provide the interceptor name in the `AsanInterceptorContext`, similarly to TSan's context.
* For `interceptor_name` suppression type we don't take the stacktrace and don't symbolize.
* For the other two suppression types, we only symbolicate the stack when there is such a suppression present in the suppression file.

There's quite a few changes related to passing the AsanInterceptorContext from all the interceptors, like adding `void *ctx` to ASan-specific interceptors and passing that to `ASAN_READ_RANGE` and `ASAN_WRITE_RANGE`. For `__asan_memcpy` and related, which are called from instrumented code, I set the context pointer to be NULL, thus ignoring suppressions. I moved the implementation of them to macros, so I didn't need to change the API and so they don't create any additional stack frames.

I didn't reuse LibIgnore and the `called_from_lib` suppressions, because they only look at the immediate caller, which I don't think is enough for ASan suppressions.

Also, this time I didn't worry about refactoring `SymbolizeStack` from TSan, but after we agree on how the suppressions should be implemented, I'd be happy to do the proper refactoring so I don't have to repeat the symbolication logic in `IsSuppressed`.

Added a few more tests, including a test that checks that reports from instrumented code cannot be suppressed.

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
  lib/sanitizer_common/tests/sanitizer_suppressions_test.cc
  test/asan/TestCases/Darwin/suppressions-darwin.cc
  test/asan/TestCases/suppressions-function.cc
  test/asan/TestCases/suppressions-instrumented-code.cc
  test/asan/TestCases/suppressions-interceptor.cc
  test/asan/TestCases/suppressions-library.cc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D6280.16545.patch
Type: text/x-patch
Size: 33776 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141124/4213cf9b/attachment.bin>


More information about the llvm-commits mailing list