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

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 8 10:44:39 PDT 2025


================
@@ -107,6 +166,22 @@ 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);
+
+  if (flags()->poison_history_size > 0) {
+    GET_STACK_TRACE(/*max_size=*/16, /*fast=*/false);
+    u32 current_tid = GetCurrentTidOrInvalid();
+
+    // 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);
----------------
vitalybuka wrote:

unlikely possible because we append them and compress, and the same applies to malloc/free.
Maybe remove TODO?

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


More information about the llvm-commits mailing list