[compiler-rt] 9971269 - [sanitizer] Relax the restriction on SizeClassAllocator64::kAllocatorSize
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 27 19:47:07 PDT 2023
Author: Fangrui Song
Date: 2023-06-27T19:47:03-07:00
New Revision: 9971269ea72aeedc26718522e7e0682f79b63b6c
URL: https://github.com/llvm/llvm-project/commit/9971269ea72aeedc26718522e7e0682f79b63b6c
DIFF: https://github.com/llvm/llvm-project/commit/9971269ea72aeedc26718522e7e0682f79b63b6c.diff
LOG: [sanitizer] Relax the restriction on SizeClassAllocator64::kAllocatorSize
Commit 278ccdacdcbde3399f1fa4b3ab929212e4e0322c says that kAllocatorSize
must be >= (1<<32), but this is not accurate. This static_assert causes 128GiB
kAllocatorSize to be unable to select DefaultSizeClassMap (kRegionSize is
1<<31).
Relax the restriction to be able to satisfy the largest size class. This allows
DefaultSizeClassMap to be usable with 128GiB kAllocatorSize, with
check-{asan,lsan,sanitizer} passing.
Reviewed By: #sanitizers, vitalybuka, kstoimenov
Differential Revision: https://reviews.llvm.org/D153664
Added:
Modified:
compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
Removed:
################################################################################
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
index 66ba71d325dad..fa43ac50c61e4 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h
@@ -635,8 +635,8 @@ class SizeClassAllocator64 {
return kUsingConstantSpaceBeg ? kSpaceBeg : NonConstSpaceBeg;
}
uptr SpaceEnd() const { return SpaceBeg() + kSpaceSize; }
- // kRegionSize must be >= 2^32.
- COMPILER_CHECK((kRegionSize) >= (1ULL << (SANITIZER_WORDSIZE / 2)));
+ // kRegionSize should be able to satisfy the largest size class.
+ static_assert(kRegionSize >= SizeClassMap::kMaxSize);
// kRegionSize must be <= 2^36, see CompactPtrT.
COMPILER_CHECK((kRegionSize) <= (1ULL << (SANITIZER_WORDSIZE / 2 + 4)));
// Call mmap for user memory with at least this size.
More information about the llvm-commits
mailing list