[llvm-commits] [compiler-rt] r146752 - in /compiler-rt/trunk/lib/asan: asan_mac.cc asan_thread.cc asan_thread.h
Kostya Serebryany
kcc at google.com
Fri Dec 16 11:13:35 PST 2011
Author: kcc
Date: Fri Dec 16 13:13:35 2011
New Revision: 146752
URL: http://llvm.org/viewvc/llvm-project?rev=146752&view=rev
Log:
Recently the GCD tests started failing because of the invalid size of
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 at google.com
Modified:
compiler-rt/trunk/lib/asan/asan_mac.cc
compiler-rt/trunk/lib/asan/asan_thread.cc
compiler-rt/trunk/lib/asan/asan_thread.h
Modified: compiler-rt/trunk/lib/asan/asan_mac.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_mac.cc?rev=146752&r1=146751&r2=146752&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_mac.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_mac.cc Fri Dec 16 13:13:35 2011
@@ -106,6 +106,7 @@
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.
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=146752&r1=146751&r2=146752&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_thread.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_thread.cc Fri Dec 16 13:13:35 2011
@@ -51,7 +51,7 @@
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 @@
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
Modified: compiler-rt/trunk/lib/asan/asan_thread.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_thread.h?rev=146752&r1=146751&r2=146752&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_thread.h (original)
+++ compiler-rt/trunk/lib/asan/asan_thread.h Fri Dec 16 13:13:35 2011
@@ -66,6 +66,7 @@
void *arg, AsanStackTrace *stack);
~AsanThread();
+ void Init(); // Should be called from the thread itself.
void *ThreadStart();
uintptr_t stack_top() { return stack_top_; }
More information about the llvm-commits
mailing list