diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stack_store.h b/compiler-rt/lib/sanitizer_common/sanitizer_stack_store.h --- a/compiler-rt/lib/sanitizer_common/sanitizer_stack_store.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stack_store.h @@ -46,6 +46,9 @@ // Returns the number of released bytes. uptr Pack(Compression type); + void LockAll(); + void UnlockAll(); + void TestOnlyUnmap(); private: @@ -101,6 +104,8 @@ void TestOnlyUnmap(); bool Stored(uptr n); bool IsPacked() const; + void Lock() NO_THREAD_SAFETY_ANALYSIS { mtx_.Lock(); } + void Unlock() NO_THREAD_SAFETY_ANALYSIS { mtx_.Unlock(); } }; BlockInfo blocks_[kBlockCount] = {}; diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stack_store.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stack_store.cpp --- a/compiler-rt/lib/sanitizer_common/sanitizer_stack_store.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stack_store.cpp @@ -102,6 +102,14 @@ return res; } +void StackStore::LockAll() { + for (BlockInfo &b : blocks_) b.Lock(); +} + +void StackStore::UnlockAll() { + for (BlockInfo &b : blocks_) b.Unlock(); +} + void StackStore::TestOnlyUnmap() { for (BlockInfo &b : blocks_) b.TestOnlyUnmap(); internal_memset(this, 0, sizeof(*this)); diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp --- a/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_stackdepot.cpp @@ -113,9 +113,11 @@ void StackDepotLockAll() { theDepot.LockAll(); + stackStore.LockAll(); } void StackDepotUnlockAll() { + stackStore.UnlockAll(); theDepot.UnlockAll(); }