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

Thurston Dang via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 10 11:19:28 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)
----------------
thurstond wrote:

Nice catch! Fixed. I also added a partial granule test case (compiler-rt/test/asan/TestCases/use-after-poison-history-size-partial-granule.cpp): https://github.com/llvm/llvm-project/pull/133175/commits/f4c7b3f8cb5346529647f6aa4dd0410ef05130a0

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


More information about the llvm-commits mailing list