Skip to content

Commit 310285e

Browse files
committed
[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. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@269917 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 92e12a6 commit 310285e

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

lib/asan/asan_rtl.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,8 +553,14 @@ static void AsanInitInternal() {
553553

554554
InitializeSuppressions();
555555

556-
// TODO(kuba) Fix Me.
557-
// Symbolizer::LateInitialize();
556+
{
557+
#if CAN_SANITIZE_LEAKS
558+
// LateInitialize() calls dlsym, which can allocate an error string buffer
559+
// in the TLS. Let's ignore the allocation to avoid reporting a leak.
560+
__lsan::ScopedInterceptorDisabler disabler;
561+
#endif
562+
Symbolizer::LateInitialize();
563+
}
558564

559565
VReport(1, "AddressSanitizer Init done\n");
560566
}

lib/tsan/rtl/tsan_rtl.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,8 +371,7 @@ void Initialize(ThreadState *thr) {
371371
ctx->initialized = true;
372372

373373
#ifndef SANITIZER_GO
374-
// TODO(kuba) Fix Me.
375-
// Symbolizer::LateInitialize();
374+
Symbolizer::LateInitialize();
376375
#endif
377376

378377
if (flags()->stop_on_start) {

0 commit comments

Comments
 (0)