summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Potapenko <glider@google.com>2012-02-21 08:45:41 +0000
committerAlexander Potapenko <glider@google.com>2012-02-21 08:45:41 +0000
commit0be25d562c02afda298423815906a03f559a21bf (patch)
treefc3b92bc6fc9c5cc1b47365d714e6176e7e09413
parent1f3325a6d9baf21c27a530d34921c71bec821ba8 (diff)
downloadbcm5719-llvm-0be25d562c02afda298423815906a03f559a21bf.tar.gz
bcm5719-llvm-0be25d562c02afda298423815906a03f559a21bf.zip
Check that the FakeStack size is non-zero before looking into it.
Sometimes DescribeStackAddress is called before another thread's FakeStack is initialized, which could previously cause a check to fire. llvm-svn: 151046
-rw-r--r--compiler-rt/lib/asan/asan_allocator.h1
-rw-r--r--compiler-rt/lib/asan/asan_thread_registry.cc2
2 files changed, 2 insertions, 1 deletions
diff --git a/compiler-rt/lib/asan/asan_allocator.h b/compiler-rt/lib/asan/asan_allocator.h
index c754eed5a3a..cc6ac8487d5 100644
--- a/compiler-rt/lib/asan/asan_allocator.h
+++ b/compiler-rt/lib/asan/asan_allocator.h
@@ -107,6 +107,7 @@ class FakeStack {
static void OnFree(size_t ptr, size_t size, size_t real_stack);
// Return the bottom of the maped region.
uintptr_t AddrIsInFakeStack(uintptr_t addr);
+ bool StackSize() { return stack_size_; }
private:
static const size_t kMinStackFrameSizeLog = 9; // Min frame is 512B.
static const size_t kMaxStackFrameSizeLog = 16; // Max stack frame is 64K.
diff --git a/compiler-rt/lib/asan/asan_thread_registry.cc b/compiler-rt/lib/asan/asan_thread_registry.cc
index 56208e62a2c..198b2f66246 100644
--- a/compiler-rt/lib/asan/asan_thread_registry.cc
+++ b/compiler-rt/lib/asan/asan_thread_registry.cc
@@ -141,7 +141,7 @@ AsanThread *AsanThreadRegistry::FindThreadByStackAddress(uintptr_t addr) {
// Scanning the thread list backwards makes this function more reliable.
for (int tid = n_threads_ - 1; tid >= 0; tid--) {
AsanThread *t = thread_summaries_[tid]->thread();
- if (!t) continue;
+ if (!t || !(t->fake_stack().StackSize())) continue;
if (t->fake_stack().AddrIsInFakeStack(addr) || t->AddrIsInStack(addr)) {
return t;
}
OpenPOWER on IntegriCloud