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

Thurston Dang via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 27 09:47:44 PDT 2025


================
@@ -107,6 +144,31 @@ void __asan_poison_memory_region(void const volatile *addr, uptr size) {
   uptr end_addr = beg_addr + size;
   VPrintf(3, "Trying to poison memory region [%p, %p)\n", (void *)beg_addr,
           (void *)end_addr);
+
+  u32 poison_magic = kAsanUserPoisonedMemoryMagic;
+
+  GET_CALLER_PC_BP;
+  GET_STORE_STACK_TRACE_PC_BP(pc, bp);
+  // TODO: garbage collect stacks once they fall off the ring buffer?
+  // StackDepot doesn't currently have a way to delete stacks.
+  u32 stack_id = StackDepotPut(stack);
----------------
thurstond wrote:

Moved inside `if (flags()->track_poison > 0)`

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


More information about the llvm-commits mailing list