[scudo] Lock FallbackTSD before draining it
Differential Revision: https://reviews.llvm.org/D150301
GitOrigin-RevId: 6561032e1d3c561b3f7ced817bf3350b8622bf92
diff --git a/tsd_exclusive.h b/tsd_exclusive.h
index 9d03773..2383674 100644
--- a/tsd_exclusive.h
+++ b/tsd_exclusive.h
@@ -63,7 +63,9 @@
// We don't have a way to iterate all thread local `ThreadTSD`s. Simply
// drain the `ThreadTSD` of current thread and `FallbackTSD`.
Instance->drainCache(&ThreadTSD);
+ FallbackTSD.lock();
Instance->drainCache(&FallbackTSD);
+ FallbackTSD.unlock();
}
ALWAYS_INLINE void initThreadMaybe(Allocator *Instance, bool MinimalInit) {