[sanitizer] Fix a crash when demangling Swift symbols, take 3

The previous patch (r269291) was reverted (commented out) because the patch caused leaks that
were detected by LSan and they broke some lit tests.  The actual reason was that dlsym allocates
an error string buffer in TLS, and some LSan lit tests are intentionally not scanning TLS for
root pointers.  This patch simply makes LSan ignore the allocation from dlsym, because it's
not interesting anyway.

llvm-svn: 269917
This commit is contained in:
Kuba Brecka 2016-05-18 13:00:20 +00:00
parent 7751c92582
commit daac6a0083
2 changed files with 9 additions and 4 deletions

View File

@ -553,8 +553,14 @@ static void AsanInitInternal() {
InitializeSuppressions();
// TODO(kuba) Fix Me.
// Symbolizer::LateInitialize();
{
#if CAN_SANITIZE_LEAKS
// LateInitialize() calls dlsym, which can allocate an error string buffer
// in the TLS. Let's ignore the allocation to avoid reporting a leak.
__lsan::ScopedInterceptorDisabler disabler;
#endif
Symbolizer::LateInitialize();
}
VReport(1, "AddressSanitizer Init done\n");
}

View File

@ -371,8 +371,7 @@ void Initialize(ThreadState *thr) {
ctx->initialized = true;
#ifndef SANITIZER_GO
// TODO(kuba) Fix Me.
// Symbolizer::LateInitialize();
Symbolizer::LateInitialize();
#endif
if (flags()->stop_on_start) {