diff options
author | Alexey Samsonov <samsonov@google.com> | 2013-09-30 10:57:56 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2013-09-30 10:57:56 +0000 |
commit | 2946f13d6ca0cfc46d74c12e97dc40a17a7d232f (patch) | |
tree | c80e59cec2c8c29cc628b91da1d16281c9a79122 | |
parent | 4430fdb4b04ae28d22cc6b24eab762afdb2fa0b7 (diff) | |
download | compiler-rt-2946f13d6ca0cfc46d74c12e97dc40a17a7d232f.tar.gz compiler-rt-2946f13d6ca0cfc46d74c12e97dc40a17a7d232f.tar.bz2 compiler-rt-2946f13d6ca0cfc46d74c12e97dc40a17a7d232f.tar.xz |
[LSan] Rework r191522 - treat allocations with short stack traces as live
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@191662 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/lsan/lsan_common.cc | 8 | ||||
-rw-r--r-- | lib/lsan/lsan_common_linux.cc | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/lsan/lsan_common.cc b/lib/lsan/lsan_common.cc index 11a51dbe..7fa06752 100644 --- a/lib/lsan/lsan_common.cc +++ b/lib/lsan/lsan_common.cc @@ -295,14 +295,10 @@ static void CollectLeaksCb(uptr chunk, void *arg) { LsanMetadata m(chunk); if (!m.allocated()) return; if (m.tag() == kDirectlyLeaked || m.tag() == kIndirectlyLeaked) { - uptr size = 0; - const uptr *trace = StackDepotGet(m.stack_trace_id(), &size); - // Ignore leaks with one-frame stack traces (which often come from - // coroutines) - they are not actionable. - if (size <= 1) - return; uptr resolution = flags()->resolution; if (resolution > 0) { + uptr size = 0; + const uptr *trace = StackDepotGet(m.stack_trace_id(), &size); size = Min(size, resolution); leak_report->Add(StackDepotPut(trace, size), m.requested_size(), m.tag()); } else { diff --git a/lib/lsan/lsan_common_linux.cc b/lib/lsan/lsan_common_linux.cc index 6517cf14..ef8857fe 100644 --- a/lib/lsan/lsan_common_linux.cc +++ b/lib/lsan/lsan_common_linux.cc @@ -115,8 +115,12 @@ static void ProcessPlatformSpecificAllocationsCb(uptr chunk, void *arg) { LsanMetadata m(chunk); if (m.allocated() && m.tag() != kReachable) { u32 stack_id = m.stack_trace_id(); - if (!stack_id || linker->containsAddress(GetCallerPC( - stack_id, param->stack_depot_reverse_map))) { + uptr caller_pc = 0; + if (stack_id > 0) + caller_pc = GetCallerPC(stack_id, param->stack_depot_reverse_map); + // If caller_pc is unknown, this chunk may be allocated in a coroutine. Mark + // it as reachable, as we can't properly report its allocation stack anyway. + if (caller_pc == 0 || linker->containsAddress(caller_pc)) { m.set_tag(kReachable); param->frontier->push_back(chunk); } |