summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_thread_registry.cc
diff options
context:
space:
mode:
authorKuba Brecka <kuba.brecka@gmail.com>2016-05-02 15:06:08 +0000
committerKuba Brecka <kuba.brecka@gmail.com>2016-05-02 15:06:08 +0000
commit4e704facb41037e14f8f51332b839accabf3b016 (patch)
treedec27d1d8b9c5f5e24f76db90395d1408508f9ba /lib/sanitizer_common/sanitizer_thread_registry.cc
parent6d7e49d4d2f31a605745e436305eac8a29536b3d (diff)
[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 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@268238 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_thread_registry.cc')
-rw-r--r--lib/sanitizer_common/sanitizer_thread_registry.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_thread_registry.cc b/lib/sanitizer_common/sanitizer_thread_registry.cc
index 2ec92ffd3..6e7ddfa64 100644
--- a/lib/sanitizer_common/sanitizer_thread_registry.cc
+++ b/lib/sanitizer_common/sanitizer_thread_registry.cc
@@ -277,6 +277,8 @@ void ThreadRegistry::StartThread(u32 tid, uptr os_id, void *arg) {
}
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;