Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions compiler-rt/lib/scudo/standalone/tsd_shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,15 @@ struct TSDRegistrySharedT {

void disable() NO_THREAD_SAFETY_ANALYSIS {
Mutex.lock();
MutexTSDs.lock();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also add ACQUIRED_BEFORE(MutexTSDs) on Mutex? Even though there's no thread safety analysis for enable()/disable() but I guess in init() this can be useful.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like this might confuse people since Mutex and MutexTSDs are not really related. Looking at this more closely, I'm not sure we really need both Mutexes since one is only used for initialization and the other used for the TSD access. I don't want to make that change in this pull request though. But I'm going to look at a follow-on that removes Mutex completely. If there is a reason to keep them separate, let me know.

for (u32 I = 0; I < TSDsArraySize; I++)
TSDs[I].lock();
}

void enable() NO_THREAD_SAFETY_ANALYSIS {
for (s32 I = static_cast<s32>(TSDsArraySize - 1); I >= 0; I--)
TSDs[I].unlock();
MutexTSDs.unlock();
Mutex.unlock();
}

Expand Down