[llvm-commits] Asan interception library patch (issue 6010049)

dvyukov at google.com dvyukov at google.com
Thu Apr 12 07:16:49 PDT 2012


The idea of this patch is as follows.
Consider that a user program defines own function read(), and Asan
intercepts
read() as well. Currently we get 'duplicate symbol' linker error in this
case.
With this patch it's possible to successfully link and detect the
situation in
run-time.
For example, here is how Tsanv2 output looks on a hypothetical program
that
refines own read() and write():
$ tests/tsan_test
ThreadSanitizer: failed to intercept 'read' function
ThreadSanitizer: failed to intercept 'write' function
[==========] Running 58 tests from 11 test cases.
[----------] Global test environment set-up.
...

The trick is to make the interceptors weak symbols + a bit of compiler
magic to
detect interception failure.

P.s. the patch changes names of interceptors on Linux from e.g. read()
to
interception_wrap_read().

http://codereview.appspot.com/6010049/



More information about the llvm-commits mailing list