[compiler-rt] r210315 - [asan] initialize fake_stack_ to 0 before we call SetThreadStackAndTls, because that may actually try to use fake_stack_ (still don't know how). Yet another case where we desperately want https://sourceware.org/glibc/wiki/ThreadPropertiesAPI

Kostya Serebryany kcc at google.com
Fri Jun 6 00:35:36 PDT 2014


Author: kcc
Date: Fri Jun  6 02:35:35 2014
New Revision: 210315

URL: http://llvm.org/viewvc/llvm-project?rev=210315&view=rev
Log:
[asan] initialize fake_stack_ to 0 before we call SetThreadStackAndTls, because that may actually try to use fake_stack_ (still don't know how). Yet another case where we desperately want https://sourceware.org/glibc/wiki/ThreadPropertiesAPI

Modified:
    compiler-rt/trunk/lib/asan/asan_thread.cc

Modified: compiler-rt/trunk/lib/asan/asan_thread.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_thread.cc?rev=210315&r1=210314&r2=210315&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_thread.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_thread.cc Fri Jun  6 02:35:35 2014
@@ -141,7 +141,10 @@ FakeStack *AsanThread::AsyncSignalSafeLa
 }
 
 void AsanThread::Init() {
+  fake_stack_ = 0;  // Will be initialized lazily if needed.
+  CHECK_EQ(this->stack_size(), 0U);
   SetThreadStackAndTls();
+  CHECK_GT(this->stack_size(), 0U);
   CHECK(AddrIsInMem(stack_bottom_));
   CHECK(AddrIsInMem(stack_top_ - 1));
   ClearShadowForThreadStackAndTLS();
@@ -149,7 +152,6 @@ void AsanThread::Init() {
   VReport(1, "T%d: stack [%p,%p) size 0x%zx; local=%p\n", tid(),
           (void *)stack_bottom_, (void *)stack_top_, stack_top_ - stack_bottom_,
           &local);
-  fake_stack_ = 0;  // Will be initialized lazily if needed.
   AsanPlatformThreadInit();
 }
 





More information about the llvm-commits mailing list