[compiler-rt] 074d17e - [scudo] Lock/unlock MutexTSDs in disable/enable. (#169440)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 25 13:20:13 PST 2025
Author: Christopher Ferris
Date: 2025-11-25T13:20:09-08:00
New Revision: 074d17e9c8cbc6f22e65ba1211787453ea629ccb
URL: https://github.com/llvm/llvm-project/commit/074d17e9c8cbc6f22e65ba1211787453ea629ccb
DIFF: https://github.com/llvm/llvm-project/commit/074d17e9c8cbc6f22e65ba1211787453ea629ccb.diff
LOG: [scudo] Lock/unlock MutexTSDs in disable/enable. (#169440)
It is possible that a fork could occur while MutexTSDs is being held and
then cause a deadlock in a forked process when something attempts to
lock it again. Instead add it to the enable/disable list of mutexes.
Added:
Modified:
compiler-rt/lib/scudo/standalone/tsd_shared.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/scudo/standalone/tsd_shared.h b/compiler-rt/lib/scudo/standalone/tsd_shared.h
index 8b570a770b503..404e984e1f5e9 100644
--- a/compiler-rt/lib/scudo/standalone/tsd_shared.h
+++ b/compiler-rt/lib/scudo/standalone/tsd_shared.h
@@ -93,6 +93,7 @@ struct TSDRegistrySharedT {
void disable() NO_THREAD_SAFETY_ANALYSIS {
Mutex.lock();
+ MutexTSDs.lock();
for (u32 I = 0; I < TSDsArraySize; I++)
TSDs[I].lock();
}
@@ -100,6 +101,7 @@ struct TSDRegistrySharedT {
void enable() NO_THREAD_SAFETY_ANALYSIS {
for (s32 I = static_cast<s32>(TSDsArraySize - 1); I >= 0; I--)
TSDs[I].unlock();
+ MutexTSDs.unlock();
Mutex.unlock();
}
More information about the llvm-commits
mailing list