From 200afbd8ba4904241c1ebcef4fa79d739ca01f73 Mon Sep 17 00:00:00 2001 From: Sergey Matveev Date: Fri, 21 Jun 2013 14:51:52 +0000 Subject: [asan] Move lsan_disabled out of thread context. Fix for the case where disabler is used in pthread key destructor. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@184553 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/lsan/lsan_allocator.cc | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) (limited to 'lib/lsan/lsan_allocator.cc') diff --git a/lib/lsan/lsan_allocator.cc b/lib/lsan/lsan_allocator.cc index 08b8fbd04..bf2c2e553 100644 --- a/lib/lsan/lsan_allocator.cc +++ b/lib/lsan/lsan_allocator.cc @@ -44,8 +44,6 @@ typedef CombinedAllocator 0 will be treated as non-leaks. -static THREADLOCAL uptr lsan_disabled; void InitializeAllocator() { allocator.Init(); @@ -63,7 +61,7 @@ static void RegisterAllocation(const StackTrace &stack, void *p, uptr size) { if (!p) return; ChunkMetadata *m = Metadata(p); CHECK(m); - m->tag = lsan_disabled ? kIgnored : kDirectlyLeaked; + m->tag = DisabledInThisThread() ? kIgnored : kDirectlyLeaked; m->stack_trace_id = StackDepotPut(stack.trace, stack.size); m->requested_size = size; atomic_store((atomic_uint8_t*)m, 1, memory_order_relaxed); @@ -188,8 +186,8 @@ template void ForEachChunk(PrintLeakedCb const &callback); template void ForEachChunk(CollectLeaksCb const &callback); template void ForEachChunk( MarkIndirectlyLeakedCb const &callback); -template void ForEachChunk( - CollectSuppressedCb const &callback); +template void ForEachChunk( + CollectIgnoredCb const &callback); IgnoreObjectResult IgnoreObjectLocked(const void *p) { void *chunk = allocator.GetBlockBegin(p); @@ -206,20 +204,3 @@ IgnoreObjectResult IgnoreObjectLocked(const void *p) { } } } // namespace __lsan - -extern "C" { -SANITIZER_INTERFACE_ATTRIBUTE -void __lsan_disable() { - __lsan::lsan_disabled++; -} - -SANITIZER_INTERFACE_ATTRIBUTE -void __lsan_enable() { - if (!__lsan::lsan_disabled) { - Report("Unmatched call to __lsan_enable().\n"); - Die(); - } - __lsan::lsan_disabled--; -} -} // extern "C" - -- cgit v1.2.3