Page MenuHomePhabricator

[sanitizer_common] Ignore unloading of suppressed library

Authored by protze.joachim on Mar 25 2018, 2:15 PM.



When suppressing errors from uninstrumented MPI libraries, sanitizer runtime calls Die(), because some of the suppressed libraries are unloaded during execution.

This patch is to remove the hard failure and change the message to a verbose message.

Diff Detail

Event Timeline

protze.joachim created this revision.Mar 25 2018, 2:15 PM

Could you please try to create a test which crashes here?

I added a testcase. I added it just for Linux, because I have no machine ready to test dl-loading on other OS.

The test succeeds with the patch, but "Die"s when replacing the clang calls with release clang.
The test includes the library to be built as well as the application which loads and closes the library.

looks like this affects tsan only. @dvyukov do you know why original code was so strict? The patch which added that Die() didn't explain that.

There are several reasons:

  1. The address range is still ignored after unload. So if anything else loaded at that range it will be falsely ignore and this can lead to both false positives and false negatives.
  2. The list of ignored libraries is append-only, so it's not possible to remove from it.
  3. If a library is unloaded, it can be loaded again later. This will lead to unbounded growth of the list of ignored libraries. The list is fixed size, so soon we will crash with an obscure CHECK failure.

Nobody runs tsan with verbosity flag, so that message won't be helpful. We either need to resolve the problems, or at the very least do what we do with multithreaded fork -- fail loudly unless an explicit flag a-la enable_ignored_library_unloading_yes_I_know_what_I_am_doing_and_taking_full_responsibility is given.

vitalybuka requested changes to this revision.May 10 2018, 10:32 AM

So we can have this as opt-in feature.

This revision now requires changes to proceed.May 10 2018, 10:32 AM

@dvyukov thanks for the detailed reasoning.

I found the newly documented flag ignore_noninstrumented_module and guess that this would be the better option than listing all the MPI libraries in the suppression file.

protze.joachim abandoned this revision.Aug 28 2019, 8:04 AM

TSAN_OPTIONS="ignore_noninstrumented_module=1" works for us