[compiler-rt] 2b71b7f - [NFC][Asan] Set AP32::kMetadataSize to 0
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 3 14:24:02 PDT 2020
Author: Vitaly Buka
Date: 2020-09-03T14:23:51-07:00
New Revision: 2b71b7f791cd58713df5e32b4b0132c876ed3c5b
URL: https://github.com/llvm/llvm-project/commit/2b71b7f791cd58713df5e32b4b0132c876ed3c5b
DIFF: https://github.com/llvm/llvm-project/commit/2b71b7f791cd58713df5e32b4b0132c876ed3c5b.diff
LOG: [NFC][Asan] Set AP32::kMetadataSize to 0
Asan does not use metadata with primary allocators.
It should match AP64::kMetadataSize whic is 0.
Depends on D86917.
Reviewed By: morehouse
Differential Revision: https://reviews.llvm.org/D86919
Added:
Modified:
compiler-rt/lib/asan/asan_allocator.h
compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h
compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/asan/asan_allocator.h b/compiler-rt/lib/asan/asan_allocator.h
index b37d8ef4e8d2..d60b97500a3c 100644
--- a/compiler-rt/lib/asan/asan_allocator.h
+++ b/compiler-rt/lib/asan/asan_allocator.h
@@ -171,7 +171,7 @@ template <typename AddressSpaceViewTy>
struct AP32 {
static const uptr kSpaceBeg = 0;
static const u64 kSpaceSize = SANITIZER_MMAP_RANGE_SIZE;
- static const uptr kMetadataSize = 16;
+ static const uptr kMetadataSize = 0;
typedef __asan::SizeClassMap SizeClassMap;
static const uptr kRegionSizeLog = 20;
using AddressSpaceView = AddressSpaceViewTy;
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h
index 47cc42cb411c..2c25a687c5f0 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary32.h
@@ -153,6 +153,7 @@ class SizeClassAllocator32 {
}
void *GetMetaData(const void *p) {
+ CHECK(kMetadataSize);
CHECK(PointerIsMine(p));
uptr mem = reinterpret_cast<uptr>(p);
uptr beg = ComputeRegionBeg(mem);
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
index acc61cc6ba8d..7af469c56fd6 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
@@ -230,6 +230,7 @@ class SizeClassAllocator64 {
static uptr ClassID(uptr size) { return SizeClassMap::ClassID(size); }
void *GetMetaData(const void *p) {
+ CHECK(kMetadataSize);
uptr class_id = GetSizeClass(p);
uptr size = ClassIdToSize(class_id);
uptr chunk_idx = GetChunkIdx(reinterpret_cast<uptr>(p), size);
More information about the llvm-commits
mailing list