Skip to content

Commit 9971269

Browse files
committed
[sanitizer] Relax the restriction on SizeClassAllocator64::kAllocatorSize
Commit 278ccda 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
1 parent ebbfdca commit 9971269

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_allocator_primary64.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -635,8 +635,8 @@ class SizeClassAllocator64 {
635635
return kUsingConstantSpaceBeg ? kSpaceBeg : NonConstSpaceBeg;
636636
}
637637
uptr SpaceEnd() const { return SpaceBeg() + kSpaceSize; }
638-
// kRegionSize must be >= 2^32.
639-
COMPILER_CHECK((kRegionSize) >= (1ULL << (SANITIZER_WORDSIZE / 2)));
638+
// kRegionSize should be able to satisfy the largest size class.
639+
static_assert(kRegionSize >= SizeClassMap::kMaxSize);
640640
// kRegionSize must be <= 2^36, see CompactPtrT.
641641
COMPILER_CHECK((kRegionSize) <= (1ULL << (SANITIZER_WORDSIZE / 2 + 4)));
642642
// Call mmap for user memory with at least this size.

0 commit comments

Comments
 (0)