[llvm-branch-commits] [tsan] Set `thr->is_inited` after SlotAttachAndLock (PR #86342)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Mar 22 14:31:12 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Vitaly Buka (vitalybuka)

<details>
<summary>Changes</summary>

Almost NFC.

This is symmetrical to `ThreadFinish`, which
resets the slot after `is_inited`.


---
Full diff: https://github.com/llvm/llvm-project/pull/86342.diff


1 Files Affected:

- (modified) compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp (+4-3) 


``````````diff
diff --git a/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp b/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp
index 06c34a2e438388..5316a7862e449c 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_rtl_thread.cpp
@@ -160,6 +160,10 @@ void ThreadStart(ThreadState *thr, Tid tid, tid_t os_id,
   }
   Free(thr->tctx->sync);
 
+#if !SANITIZER_GO
+  thr->is_inited = true;
+#endif
+
   uptr stk_addr = 0;
   uptr stk_size = 0;
   uptr tls_addr = 0;
@@ -205,9 +209,6 @@ void ThreadContext::OnStarted(void *arg) {
   if (common_flags()->detect_deadlocks)
     thr->dd_lt = ctx->dd->CreateLogicalThread(tid);
   thr->tctx = this;
-#if !SANITIZER_GO
-  thr->is_inited = true;
-#endif
 }
 
 void ThreadFinish(ThreadState *thr) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/86342


More information about the llvm-branch-commits mailing list