mirror of
https://github.com/intel/llvm.git
synced 2026-01-13 19:08:21 +08:00
[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.
This commit is contained in:
committed by
GitHub
parent
00ffc70ba1
commit
074d17e9c8
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user