[compiler-rt] [asan] Add experimental 'track_poison' flag (PR #133175)
    Vitaly Buka via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Fri Mar 28 16:59:29 PDT 2025
    
    
  
================
@@ -20,11 +20,33 @@
 #include "sanitizer_common/sanitizer_flags.h"
 #include "sanitizer_common/sanitizer_interface_internal.h"
 #include "sanitizer_common/sanitizer_libc.h"
+#include "sanitizer_common/sanitizer_stackdepot.h"
 
 namespace __asan {
 
 static atomic_uint8_t can_poison_memory;
 
+static Mutex PoisonRecordsMutex;
+static PoisonRecordRingBuffer *PoisonRecords = nullptr;
+
+void InitializePoisonTracking() {
+  if (flags()->track_poison <= 0)
+    return;
+
+  PoisonRecords = PoisonRecordRingBuffer::New(flags()->track_poison);
+}
+
+PoisonRecordRingBuffer *SANITIZER_ACQUIRE(PoisonRecordsMutex)
----------------
vitalybuka wrote:
please check __asan::InstallAtForkHandler
Probably we need `Lock/Unlock PoisonRecords();` there
https://github.com/llvm/llvm-project/pull/133175
    
    
More information about the llvm-commits
mailing list