diff --git a/compiler-rt/lib/scudo/standalone/tsd_exclusive.h b/compiler-rt/lib/scudo/standalone/tsd_exclusive.h --- a/compiler-rt/lib/scudo/standalone/tsd_exclusive.h +++ b/compiler-rt/lib/scudo/standalone/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) {