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:
Please don't. Symbolizing stack trace make take a long time and may not succeed. Also, you don't pass unwinded stack down, which means that you'd have to unwind it once again in __asan_report_error.