[PATCH] D48033: [ASAN] fix crash in GetGlobalsForAddress after dlclose

Peter Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 11 10:00:44 PDT 2018


Lekensteyn added a comment.

Note: the issue was reproduced on both Linux (clang from trunk) and Windows (Clang 6.0.0). The fix was tested for Linux, but not on Windows (if someone has a setup ready, please test!).

`ASAN_OPTIONS=handle_segv=0` is set to avoid a hang due to a recursive invocation on the unfixed library:

  AddressSanitizer:DEADLYSIGNAL
  #0  __sanitizer::BlockingMutex::Lock () projects/compiler-rt/lib/sanitizer_common/sanitizer_linux.cc:665
  #1  0x00000000004f2394 in __sanitizer::ThreadRegistry::Lock () projects/compiler-rt/lib/asan/../sanitizer_common/sanitizer_thread_registry.h:92
  #2  __asan::ScopedInErrorReport::ScopedInErrorReport () projects/compiler-rt/lib/asan/asan_report.cc:131
  #3  __asan::ReportDeadlySignal () projects/compiler-rt/lib/asan/asan_report.cc:212
  #4  0x00000000004f0e25 in __asan::AsanOnDeadlySignal () projects/compiler-rt/lib/asan/asan_posix.cc:38
  #5  <signal handler called>
  #6  0x0000000000435e99 in __asan::GetGlobalsForAddress () projects/compiler-rt/lib/asan/asan_flags.h:42
  #7  0x000000000042c153 in __asan::GetGlobalAddressInformation () projects/compiler-rt/lib/asan/asan_descriptions.cc:307
  #8  __asan::PrintAddressDescription () projects/compiler-rt/lib/asan/asan_descriptions.cc:489
  #9  0x00000000004f9d96 in __asan_describe_address () projects/compiler-rt/lib/asan/asan_report.cc:486
  #10 0x000000000052b649 in main () projects/compiler-rt/test/asan/TestCases/Posix/dlclose-globals.cc:30

I have not done a measurement against projects that have many globals and unload large libraries with many globals. If the most recently loaded library is unloaded first, then performance should not be that bad as the globals are expected to be in the front of the list.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D48033





More information about the llvm-commits mailing list