From 63886c21ec9c65c8e6278c729e75f761bde15a3a Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Mon, 8 Nov 2021 19:10:10 -0800 Subject: [PATCH] [NFC][dfsan] Split Init and ThreadStart --- compiler-rt/lib/dfsan/dfsan.cpp | 2 +- compiler-rt/lib/dfsan/dfsan_custom.cpp | 1 + compiler-rt/lib/dfsan/dfsan_thread.cpp | 2 -- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/compiler-rt/lib/dfsan/dfsan.cpp b/compiler-rt/lib/dfsan/dfsan.cpp index 67f303e02eea..ce2c04df83a8 100644 --- a/compiler-rt/lib/dfsan/dfsan.cpp +++ b/compiler-rt/lib/dfsan/dfsan.cpp @@ -991,7 +991,7 @@ static void DFsanInit(int argc, char **argv, char **envp) { DFsanThread *main_thread = DFsanThread::Create(nullptr, nullptr, nullptr); SetCurrentThread(main_thread); - main_thread->ThreadStart(); + main_thread->Init(); dfsan_init_is_running = false; dfsan_inited = true; diff --git a/compiler-rt/lib/dfsan/dfsan_custom.cpp b/compiler-rt/lib/dfsan/dfsan_custom.cpp index 97aa13525b7a..2ecbc0703366 100644 --- a/compiler-rt/lib/dfsan/dfsan_custom.cpp +++ b/compiler-rt/lib/dfsan/dfsan_custom.cpp @@ -755,6 +755,7 @@ SANITIZER_INTERFACE_ATTRIBUTE void *__dfso_dlopen( static void *DFsanThreadStartFunc(void *arg) { DFsanThread *t = (DFsanThread *)arg; SetCurrentThread(t); + t->Init(); return t->ThreadStart(); } diff --git a/compiler-rt/lib/dfsan/dfsan_thread.cpp b/compiler-rt/lib/dfsan/dfsan_thread.cpp index 6869cf231587..df7e4d9b7421 100644 --- a/compiler-rt/lib/dfsan/dfsan_thread.cpp +++ b/compiler-rt/lib/dfsan/dfsan_thread.cpp @@ -67,8 +67,6 @@ void DFsanThread::Destroy() { } thread_return_t DFsanThread::ThreadStart() { - Init(); - if (!start_routine_) { // start_routine_ == 0 if we're on the main thread or on one of the // OS X libdispatch worker threads. But nobody is supposed to call