[compiler-rt] [scudo] Add two missing locks to enable/disable. (PR #79670)

via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 26 18:02:03 PST 2024


================
@@ -136,6 +136,14 @@ class StackDepot {
   u64 operator[](uptr RingPos) const {
     return atomic_load_relaxed(&Ring[RingPos & RingMask]);
   }
+
+  void disable() NO_THREAD_SAFETY_ANALYSIS {
+    RingEndMu.lock();
+  }
+
+  void enable() NO_THREAD_SAFETY_ANALYSIS {
+    RingEndMu.unlock();
+  }
----------------
ChiaHungDuan wrote:

Can you share more details about the deadlock? From where the `RingEndMu` is used (only in the `insert()` above and it seems to me that it's not disabling the StackDepot. For example, `find()` is still working when we call `disable()`. 
I'm wondering if we want a different lock to guard all the operations (we may not be able to lock in the user because it passes the address of `Depot`)

https://github.com/llvm/llvm-project/pull/79670


More information about the llvm-commits mailing list