summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--compiler-rt/lib/asan/asan_mac.cc1
-rw-r--r--compiler-rt/lib/asan/asan_thread.cc6
-rw-r--r--compiler-rt/lib/asan/asan_thread.h1
3 files changed, 7 insertions, 1 deletions
diff --git a/compiler-rt/lib/asan/asan_mac.cc b/compiler-rt/lib/asan/asan_mac.cc
index af4d95e88bf..43e8c00ba06 100644
--- a/compiler-rt/lib/asan/asan_mac.cc
+++ b/compiler-rt/lib/asan/asan_mac.cc
@@ -106,6 +106,7 @@ void asan_dispatch_call_block_and_release(void *block) {
t = (AsanThread*)asan_malloc(sizeof(AsanThread), &stack);
new(t) AsanThread(context->parent_tid,
/*start_routine*/NULL, /*arg*/NULL, &stack);
+ t->Init();
asanThreadRegistry().SetCurrent(t);
}
// Call the original dispatcher for the block.
diff --git a/compiler-rt/lib/asan/asan_thread.cc b/compiler-rt/lib/asan/asan_thread.cc
index 27fa2fe98e3..a71ad8d3751 100644
--- a/compiler-rt/lib/asan/asan_thread.cc
+++ b/compiler-rt/lib/asan/asan_thread.cc
@@ -51,7 +51,7 @@ void AsanThread::ClearShadowForThreadStack() {
real_memset((void*)shadow_bot, 0, shadow_top - shadow_bot);
}
-void *AsanThread::ThreadStart() {
+void AsanThread::Init() {
SetThreadStackTopAndBottom();
fake_stack_.Init(stack_size());
if (FLAG_v >= 1) {
@@ -65,6 +65,10 @@ void *AsanThread::ThreadStart() {
CHECK(AddrIsInMem(stack_top_));
ClearShadowForThreadStack();
+}
+
+void *AsanThread::ThreadStart() {
+ Init();
if (!start_routine_) {
// start_routine_ == NULL if we're on the main thread or on one of the
diff --git a/compiler-rt/lib/asan/asan_thread.h b/compiler-rt/lib/asan/asan_thread.h
index 2e68b0d01f0..c382c85a6a3 100644
--- a/compiler-rt/lib/asan/asan_thread.h
+++ b/compiler-rt/lib/asan/asan_thread.h
@@ -66,6 +66,7 @@ class AsanThread {
void *arg, AsanStackTrace *stack);
~AsanThread();
+ void Init(); // Should be called from the thread itself.
void *ThreadStart();
uintptr_t stack_top() { return stack_top_; }
OpenPOWER on IntegriCloud