[compiler-rt] [hwasan] Fix stack tag mismatch report (PR #81939)

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 15 16:03:28 PST 2024


================
@@ -230,33 +230,70 @@ static void PrintStackAllocations(const StackAllocationsRingBuffer *sa,
       tag_t obj_tag = base_tag ^ local.tag_offset;
       if (obj_tag != addr_tag)
         continue;
-      // Guess top bits of local variable from the faulting address, because
-      // we only store bits 4-19 of FP (bits 0-3 are guaranteed to be zero).
-      uptr local_beg = (fp + local.frame_offset) |
-                       (untagged_addr & ~(uptr(kRecordFPModulus) - 1));
-      uptr local_end = local_beg + local.size;
+
+      // We only store bits 4-19 of FP (bits 0-3 are guaranteed to be zero).
+      // So we know only `FP % kRecordFPModulus`, and we can only calculate
+      // `local_beg % kRecordFPModulus`.
+      // Out of all possible `local_beg` we will only consider two candidates
----------------
fmayer wrote:

maybe state that 2 is an arbitrary number?

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


More information about the llvm-commits mailing list