[PATCH] D61708: [TSan] Support `ignore_noninstrumented_modules` on Linux

Julian Lettner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 8 17:45:55 PDT 2019


yln created this revision.
Herald added subscribers: llvm-commits, Sanitizers, kubamracek.
Herald added projects: Sanitizers, LLVM.

We implemented the `ignore_noninstrumented_modules` flag for Darwin [1]
to be able to use TSan on Darwin, where the "re-compile the world"
approach is difficult to follow in practice.

Now we are in the same situation when adding TSan support for Swift on
Linux.  The libdispatch library is a source of false positives and
compiling it with TSan (although it is compiled from source on Linux)
proves to be tricky and insufficient.  The better path seems to be to
make `ignore_noninstrumented_modules` work on Linux.

The missing piece with this functionality on Linux is the detection
whether or not a loaded library is instrumented (which is suprisingly
difficult).  In this patch we use the ELF segment metadata and symbol
table to check whether any sanitizer symbols are present.  [2,3] were
useful resources in the development of this patch (especially,
`getSymbolCountFromGnuHash`).

Also enable flag for libdispatch tests on Linux to make them pass. The
default value for this flag on Linux remains OFF.

[1]: https://reviews.llvm.org/D28264
[2]: https://chromium.googlesource.com/crashpad/crashpad/+/1f1657d573c789aa36b6022440e34d9ec30d894c%5E%21/
[3]: https://flapenguin.me/2017/05/10/elf-lookup-dt-gnu-hash/


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D61708

Files:
  compiler-rt/lib/sanitizer_common/sanitizer_common.cc
  compiler-rt/lib/sanitizer_common/sanitizer_common.h
  compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cc
  compiler-rt/test/tsan/libdispatch/lit.local.cfg

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61708.198749.patch
Type: text/x-patch
Size: 6904 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190509/183220ea/attachment.bin>


More information about the llvm-commits mailing list