Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tsan] Set thr->is_inited after SlotAttachAndLock #86342

Conversation

vitalybuka
Copy link
Collaborator

Almost NFC.

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

@llvmbot
Copy link
Collaborator

llvmbot commented Mar 22, 2024

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

Author: Vitaly Buka (vitalybuka)

Changes

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 --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) {

@vitalybuka vitalybuka changed the base branch from users/vitalybuka/spr/main.tsan-set-thr-is_inited-after-slotattachandlock to main March 22, 2024 22:11
@vitalybuka vitalybuka merged commit 0ba678a into main Mar 22, 2024
7 checks passed
@vitalybuka vitalybuka deleted the users/vitalybuka/spr/tsan-set-thr-is_inited-after-slotattachandlock branch March 22, 2024 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants