summaryrefslogtreecommitdiff
path: root/lib/lsan/lsan_allocator.cc
diff options
context:
space:
mode:
authorSergey Matveev <earthdok@google.com>2013-06-21 14:51:52 +0000
committerSergey Matveev <earthdok@google.com>2013-06-21 14:51:52 +0000
commit200afbd8ba4904241c1ebcef4fa79d739ca01f73 (patch)
tree99b06fc5181f2d0be028c38ea33c286ca3df07a4 /lib/lsan/lsan_allocator.cc
parentd530d892b4958a9ae54e57472d5d0a0bae1f6ad8 (diff)
[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
Diffstat (limited to 'lib/lsan/lsan_allocator.cc')
-rw-r--r--lib/lsan/lsan_allocator.cc25
1 files changed, 3 insertions, 22 deletions
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<PrimaryAllocator, AllocatorCache,
static Allocator allocator;
static THREADLOCAL AllocatorCache cache;
-// All allocations made while this is > 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>(PrintLeakedCb const &callback);
template void ForEachChunk<CollectLeaksCb>(CollectLeaksCb const &callback);
template void ForEachChunk<MarkIndirectlyLeakedCb>(
MarkIndirectlyLeakedCb const &callback);
-template void ForEachChunk<CollectSuppressedCb>(
- CollectSuppressedCb const &callback);
+template void ForEachChunk<CollectIgnoredCb>(
+ 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"
-