We implemented the ignore_noninstrumented_modules flag for Darwin 
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,
Also enable flag for libdispatch tests on Linux to make them pass. The
default value for this flag on Linux remains OFF.