[compiler-rt] 6561032 - [scudo] Lock FallbackTSD before draining it

Chia-hung Duan via llvm-commits llvm-commits at lists.llvm.org
Wed May 10 14:49:36 PDT 2023


Author: Chia-hung Duan
Date: 2023-05-10T21:48:56Z
New Revision: 6561032e1d3c561b3f7ced817bf3350b8622bf92

URL: https://github.com/llvm/llvm-project/commit/6561032e1d3c561b3f7ced817bf3350b8622bf92
DIFF: https://github.com/llvm/llvm-project/commit/6561032e1d3c561b3f7ced817bf3350b8622bf92.diff

LOG: [scudo] Lock FallbackTSD before draining it

Differential Revision: https://reviews.llvm.org/D150301

Added: 
    

Modified: 
    compiler-rt/lib/scudo/standalone/tsd_exclusive.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/scudo/standalone/tsd_exclusive.h b/compiler-rt/lib/scudo/standalone/tsd_exclusive.h
index 9d037731921d..238367420238 100644
--- a/compiler-rt/lib/scudo/standalone/tsd_exclusive.h
+++ b/compiler-rt/lib/scudo/standalone/tsd_exclusive.h
@@ -63,7 +63,9 @@ template <class Allocator> struct TSDRegistryExT {
     // 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) {


        


More information about the llvm-commits mailing list