[compiler-rt] ddedad8 - [NFC][hwasan] Use stored chunk in TailOverwrittenReport (#66682)

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 20 21:17:50 PDT 2023


Author: Vitaly Buka
Date: 2023-09-20T21:03:06-07:00
New Revision: ddedad8070d2b89734a30cc26d978a7d1aa6b3ee

URL: https://github.com/llvm/llvm-project/commit/ddedad8070d2b89734a30cc26d978a7d1aa6b3ee
DIFF: https://github.com/llvm/llvm-project/commit/ddedad8070d2b89734a30cc26d978a7d1aa6b3ee.diff

LOG: [NFC][hwasan] Use stored chunk in TailOverwrittenReport (#66682)

Added: 
    

Modified: 
    compiler-rt/lib/hwasan/hwasan_report.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/hwasan/hwasan_report.cpp b/compiler-rt/lib/hwasan/hwasan_report.cpp
index f40535c34d2ee0f..48ace0b9ea73fcd 100644
--- a/compiler-rt/lib/hwasan/hwasan_report.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_report.cpp
@@ -423,6 +423,7 @@ class BaseReport {
   struct HeapChunk {
     uptr begin = 0;
     uptr size = 0;
+    u32 stack_id = 0;
     bool from_small_heap = false;
     bool is_allocated = false;
   };
@@ -458,6 +459,7 @@ BaseReport::HeapChunk BaseReport::CopyHeapChunk() const {
     result.size = chunk.ActualSize();
     result.from_small_heap = chunk.FromSmallHeap();
     result.is_allocated = chunk.IsAllocated();
+    result.stack_id = chunk.GetAllocStackId();
   }
   return result;
 }
@@ -793,12 +795,11 @@ TailOverwrittenReport::~TailOverwrittenReport() {
   Printf("deallocated here:\n");
   Printf("%s", d.Default());
   stack->Print();
-  HwasanChunkView chunk = FindHeapChunkByAddress(untagged_addr);
-  if (chunk.Beg()) {
+  if (heap.begin) {
     Printf("%s", d.Allocation());
     Printf("allocated here:\n");
     Printf("%s", d.Default());
-    GetStackTraceFromId(chunk.GetAllocStackId()).Print();
+    GetStackTraceFromId(heap.stack_id).Print();
   }
 
   InternalScopedString s;


        


More information about the llvm-commits mailing list