[compiler-rt] r268238 - [sanitizer] Don't reuse the main thread in ThreadRegistry
Kuba Brecka via llvm-commits
llvm-commits at lists.llvm.org
Mon May 2 08:06:09 PDT 2016
Author: kuba.brecka
Date: Mon May 2 10:06:08 2016
New Revision: 268238
URL: http://llvm.org/viewvc/llvm-project?rev=268238&view=rev
Log:
[sanitizer] Don't reuse the main thread in ThreadRegistry
There is a hard-to-reproduce crash happening on OS X that involves terminating the main thread (dispatch_main does that, see discussion at http://reviews.llvm.org/D18496) and later reusing the main thread's ThreadContext. This patch disables reuse of the main thread. I believe this problem exists only on OS X, because on other systems the main thread cannot be terminated without exiting the process.
Differential Revision: http://reviews.llvm.org/D19722
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_thread_registry.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_thread_registry.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_thread_registry.cc?rev=268238&r1=268237&r2=268238&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_thread_registry.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_thread_registry.cc Mon May 2 10:06:08 2016
@@ -277,6 +277,8 @@ void ThreadRegistry::StartThread(u32 tid
}
void ThreadRegistry::QuarantinePush(ThreadContextBase *tctx) {
+ if (tctx->tid == 0)
+ return; // Don't reuse the main thread. It's a special snowflake.
dead_threads_.push_back(tctx);
if (dead_threads_.size() <= thread_quarantine_size_)
return;
More information about the llvm-commits
mailing list