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

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 10 11:06:40 PDT 2025


================
@@ -600,6 +602,43 @@ static void PrintShadowMemoryForAddress(uptr addr) {
   Printf("%s", str.data());
 }
 
+static void CheckPoisonRecords(uptr addr) {
+  if (!AddrIsInMem(addr))
+    return;
+  uptr shadow_addr = MemToShadow(addr);
+  unsigned char poison_magic = *(reinterpret_cast<u8 *>(shadow_addr));
+
+  if (poison_magic != kAsanUserPoisonedMemoryMagic)
----------------
vitalybuka wrote:

Actually it must be already bad address, see CHECK_SMALL_REGION :(
then access_size is not very relevant
so just check if it's partial and check the next shadow if needed.

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


More information about the llvm-commits mailing list