[llvm] [NFC] [HWASan] Add link to proof for address calculation (PR #86367)

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 22 18:14:59 PDT 2024


https://github.com/fmayer created https://github.com/llvm/llvm-project/pull/86367

None

>From 257dd552063bdbe9392548aa3cf1de024ff0b79c Mon Sep 17 00:00:00 2001
From: Florian Mayer <fmayer at google.com>
Date: Fri, 22 Mar 2024 18:14:37 -0700
Subject: [PATCH] [NFC] [HWASan] Add link to proof for address calculation

---
 llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index 3c95610fa3e80b..c8f7ed448279f3 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -1104,6 +1104,8 @@ void HWAddressSanitizer::tagAlloca(IRBuilder<> &IRB, AllocaInst *AI, Value *Tag,
     // FIXME: the interceptor is not as fast as real memset. Consider lowering
     // llvm.memset right here into either a sequence of stores, or a call to
     // hwasan_tag_memory.
+    // Mechanical proof of this address calculation can be found at:
+    // https://github.com/google/sanitizers/blob/master/hwaddress-sanitizer/prove_hwasanwrap.smt2
     if (ShadowSize)
       IRB.CreateMemSet(ShadowPtr, Tag, ShadowSize, Align(1));
     if (Size != AlignedSize) {



More information about the llvm-commits mailing list