Skip to content

Commit

Permalink
Recently the GCD tests started failing because of the invalid size of
Browse files Browse the repository at this point in the history
FakeStack on the worker threads.
This patch moves the AsanThread initialization into a separate
procedure that's called when AsanThread objects are called for worker
threads.
Patch by glider@google.com

llvm-svn: 146752
  • Loading branch information
kcc committed Dec 16, 2011
1 parent 5af1448 commit 6bb2f1d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions compiler-rt/lib/asan/asan_mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 5 additions & 1 deletion compiler-rt/lib/asan/asan_thread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions compiler-rt/lib/asan/asan_thread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_; }
Expand Down

0 comments on commit 6bb2f1d

Please sign in to comment.