diff --git a/compiler-rt/lib/hwasan/hwasan_allocator.h b/compiler-rt/lib/hwasan/hwasan_allocator.h index 67982cad254389..2093079413014c 100644 --- a/compiler-rt/lib/hwasan/hwasan_allocator.h +++ b/compiler-rt/lib/hwasan/hwasan_allocator.h @@ -68,15 +68,21 @@ struct AP64 { #if defined(HWASAN_ALIASING_MODE) static const uptr kSpaceSize = 1ULL << kAddressTagShift; + typedef __sanitizer::DefaultSizeClassMap SizeClassMap; +#elif SANITIZER_LINUX && !SANITIZER_ANDROID + static const uptr kSpaceSize = 0x40000000000ULL; // 4T. + typedef __sanitizer::DefaultSizeClassMap SizeClassMap; #else - static const uptr kSpaceSize = 0x2000000000ULL; + static const uptr kSpaceSize = 0x2000000000ULL; // 128G. + typedef __sanitizer::VeryDenseSizeClassMap SizeClassMap; #endif + static const uptr kMetadataSize = sizeof(Metadata); - typedef __sanitizer::VeryDenseSizeClassMap SizeClassMap; using AddressSpaceView = LocalAddressSpaceView; typedef HwasanMapUnmapCallback MapUnmapCallback; static const uptr kFlags = 0; }; + typedef SizeClassAllocator64 PrimaryAllocator; typedef CombinedAllocator Allocator; typedef Allocator::AllocatorCache AllocatorCache; diff --git a/compiler-rt/test/hwasan/TestCases/Linux/decorate-proc-maps.c b/compiler-rt/test/hwasan/TestCases/Linux/decorate-proc-maps.c index 40e8c0ed8bb754..1c4e2e7c76d3b1 100644 --- a/compiler-rt/test/hwasan/TestCases/Linux/decorate-proc-maps.c +++ b/compiler-rt/test/hwasan/TestCases/Linux/decorate-proc-maps.c @@ -48,7 +48,7 @@ void *ThreadFn(void *arg) { int main(void) { pthread_t t; void * volatile res = malloc(100); - void * volatile res2 = malloc(100000); + void * volatile res2 = malloc(1000000); pthread_create(&t, 0, ThreadFn, 0); pthread_join(t, 0); int ret_val = (int)(size_t)res; diff --git a/compiler-rt/test/hwasan/TestCases/use-after-free.c b/compiler-rt/test/hwasan/TestCases/use-after-free.c index bd09bbf889df1d..24546374341e34 100644 --- a/compiler-rt/test/hwasan/TestCases/use-after-free.c +++ b/compiler-rt/test/hwasan/TestCases/use-after-free.c @@ -27,7 +27,7 @@ int main() { // of the fault. // CHECK: in main {{.*}}use-after-free.c:[[@LINE-6]] // Offset is 5 or 11 depending on left/right alignment. - // CHECK: is a small unallocated heap chunk; size: 32 offset: {{5|11}} + // CHECK: is a small unallocated heap chunk; size: {{16|32}} offset: {{5|11}} // CHECK: Cause: use-after-free // CHECK: is located 5 bytes inside a 10-byte region //