[compiler-rt] c804775 - [hwasan] Fix LsanMetadata::LsanMetadata

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 19:23:51 PST 2023


Author: Vitaly Buka
Date: 2023-01-17T19:23:42-08:00
New Revision: c804775cd32c69bc85f738f760108cd0ac76d0f6

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

LOG: [hwasan] Fix LsanMetadata::LsanMetadata

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/hwasan/hwasan_allocator.cpp b/compiler-rt/lib/hwasan/hwasan_allocator.cpp
index e650738a12d8..9f7d1f3841d9 100644
--- a/compiler-rt/lib/hwasan/hwasan_allocator.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_allocator.cpp
@@ -106,7 +106,6 @@ inline u32 Metadata::GetAllocStackId() const {
   return atomic_load(&alloc_context_id, memory_order_relaxed);
 }
 
-static const uptr kChunkHeaderSize = sizeof(HwasanChunkView);
 
 void GetAllocatorStats(AllocatorStatCounters s) {
   allocator.GetStats(s);
@@ -534,9 +533,8 @@ uptr GetUserBegin(uptr chunk) {
 }
 
 LsanMetadata::LsanMetadata(uptr chunk) {
-  metadata_ = chunk ? reinterpret_cast<__hwasan::Metadata *>(
-                          chunk - __hwasan::kChunkHeaderSize)
-                    : nullptr;
+  metadata_ =
+      chunk ? (reinterpret_cast<__hwasan::Metadata *>(chunk) - 1) : nullptr;
 }
 
 bool LsanMetadata::allocated() const {


        


More information about the llvm-commits mailing list