[compiler-rt] [asan] Add experimental 'track_poison' flag (PR #133175)

Thurston Dang via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 1 15:15:19 PDT 2025


================
@@ -19,9 +19,25 @@
 #include "asan_mapping.h"
 #include "sanitizer_common/sanitizer_flags.h"
 #include "sanitizer_common/sanitizer_platform.h"
+#include "sanitizer_common/sanitizer_ring_buffer.h"
 
 namespace __asan {
 
+struct PoisonRecord {
+  unsigned int stack_id;
+  unsigned int thread_id;
+  uptr begin;
+  uptr end;
+};
+
+using PoisonRecordRingBuffer = RingBuffer<struct PoisonRecord>;
+
+// Set up data structures for track_poison.
+void InitializePoisonTracking();
+
+PoisonRecordRingBuffer* AcquirePoisonRecords();
----------------
thurstond wrote:

I added AddPoisonRecord and FindPoisonRecord. For FindPoisonRecord, since this may fail to find a match (e.g., it aged out of the ring buffer), I used `bool FindPoisonRecord(uptr addr, const PoisonRecord& match)`.

I kept the Acquire/Release API for the fork handler.

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


More information about the llvm-commits mailing list