[llvm-commits] [compiler-rt] r151046 - in /compiler-rt/trunk/lib/asan: asan_allocator.h asan_thread_registry.cc

Alexander Potapenko glider at google.com
Tue Feb 21 00:45:42 PST 2012


Author: glider
Date: Tue Feb 21 02:45:41 2012
New Revision: 151046

URL: http://llvm.org/viewvc/llvm-project?rev=151046&view=rev
Log:
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.

Modified:
    compiler-rt/trunk/lib/asan/asan_allocator.h
    compiler-rt/trunk/lib/asan/asan_thread_registry.cc

Modified: compiler-rt/trunk/lib/asan/asan_allocator.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_allocator.h?rev=151046&r1=151045&r2=151046&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_allocator.h (original)
+++ compiler-rt/trunk/lib/asan/asan_allocator.h Tue Feb 21 02:45:41 2012
@@ -107,6 +107,7 @@
   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.

Modified: compiler-rt/trunk/lib/asan/asan_thread_registry.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_thread_registry.cc?rev=151046&r1=151045&r2=151046&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_thread_registry.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_thread_registry.cc Tue Feb 21 02:45:41 2012
@@ -141,7 +141,7 @@
   // 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;
     }





More information about the llvm-commits mailing list