[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:16:11 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)
+ return;
+
+ PoisonRecordRingBuffer *PoisonRecord = AcquirePoisonRecords();
+ if (PoisonRecord) {
+ bool FoundMatch = false;
+
+ for (unsigned int i = 0; i < PoisonRecord->size(); i++) {
+ struct PoisonRecord Record = (*PoisonRecord)[i];
+ if (Record.begin <= addr && addr <= Record.end) {
----------------
thurstond wrote:
Fixed
https://github.com/llvm/llvm-project/pull/133175
More information about the llvm-commits
mailing list