From c804775cd32c69bc85f738f760108cd0ac76d0f6 Mon Sep 17 00:00:00 2001 From: Vitaly Buka Date: Tue, 17 Jan 2023 19:21:17 -0800 Subject: [PATCH] [hwasan] Fix LsanMetadata::LsanMetadata --- compiler-rt/lib/hwasan/hwasan_allocator.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/compiler-rt/lib/hwasan/hwasan_allocator.cpp b/compiler-rt/lib/hwasan/hwasan_allocator.cpp index e650738..9f7d1f3 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 { -- 2.7.4