diff options
author | Dmitry Vyukov <dvyukov@google.com> | 2014-09-03 12:25:22 +0000 |
---|---|---|
committer | Dmitry Vyukov <dvyukov@google.com> | 2014-09-03 12:25:22 +0000 |
commit | f8cfdd9207c67a3cb4db3cb081f3550bcc7f0535 (patch) | |
tree | 3fc6a62cc43cc80f00cf518dde6dd10b8d47a21b | |
parent | f1741f52ad6ab6f2baba9e25e2ba7fdd1d021ba3 (diff) | |
download | bcm5719-llvm-f8cfdd9207c67a3cb4db3cb081f3550bcc7f0535.tar.gz bcm5719-llvm-f8cfdd9207c67a3cb4db3cb081f3550bcc7f0535.zip |
tsan: handle early signals
The second part of the fix of
https://code.google.com/p/thread-sanitizer/issues/detail?id=71
llvm-svn: 217031
-rw-r--r-- | compiler-rt/lib/tsan/rtl/tsan_interceptors.cc | 2 | ||||
-rw-r--r-- | compiler-rt/lib/tsan/rtl/tsan_rtl.h | 2 | ||||
-rw-r--r-- | compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc | 3 | ||||
-rw-r--r-- | compiler-rt/test/tsan/signal_recursive.cc | 1 |
4 files changed, 3 insertions, 5 deletions
diff --git a/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc b/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc index 6652edb6254..1c0f2f8e8e9 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_interceptors.cc @@ -151,7 +151,7 @@ void InitializeLibIgnore() { static SignalContext *SigCtx(ThreadState *thr) { SignalContext *ctx = (SignalContext*)thr->signal_ctx; - if (ctx == 0 && thr->is_alive) { + if (ctx == 0 && !thr->is_dead) { ctx = (SignalContext*)MmapOrDie(sizeof(*ctx), "SignalContext"); MemoryResetRange(thr, (uptr)&SigCtx, (uptr)ctx, sizeof(*ctx)); thr->signal_ctx = ctx; diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl.h b/compiler-rt/lib/tsan/rtl/tsan_rtl.h index 7b0b8e06b51..1a926c0fc6e 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_rtl.h +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl.h @@ -356,7 +356,7 @@ struct ThreadState { const int unique_id; bool in_symbolizer; bool in_ignored_lib; - bool is_alive; + bool is_dead; bool is_freeing; bool is_vptr_access; const uptr stk_addr; diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc b/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc index a08c1e04889..156f3b81e60 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc +++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cc @@ -123,7 +123,6 @@ void ThreadContext::OnStarted(void *arg) { "tls_addr=%zx tls_size=%zx\n", tid, (uptr)epoch0, args->stk_addr, args->stk_size, args->tls_addr, args->tls_size); - thr->is_alive = true; } void ThreadContext::OnFinished() { @@ -284,7 +283,7 @@ void ThreadFinish(ThreadState *thr) { DontNeedShadowFor(thr->stk_addr, thr->stk_size); if (thr->tls_addr && thr->tls_size) DontNeedShadowFor(thr->tls_addr, thr->tls_size); - thr->is_alive = false; + thr->is_dead = true; ctx->thread_registry->FinishThread(thr->tid); } diff --git a/compiler-rt/test/tsan/signal_recursive.cc b/compiler-rt/test/tsan/signal_recursive.cc index d3e9dbb9f8c..db1d8b0f6d1 100644 --- a/compiler-rt/test/tsan/signal_recursive.cc +++ b/compiler-rt/test/tsan/signal_recursive.cc @@ -119,7 +119,6 @@ int main(int argc, const char *argv[]) { Init(); pthread_t busy_thread; pthread_create(&busy_thread, NULL, &BusyThread, NULL); - sleep(1); // Tsan deadlocks without these sleeps CollectGarbage(busy_thread); pthread_join(busy_thread, 0); fprintf(stderr, "DONE\n"); |