diff --git a/compiler-rt/lib/hwasan/hwasan_allocator.h b/compiler-rt/lib/hwasan/hwasan_allocator.h --- a/compiler-rt/lib/hwasan/hwasan_allocator.h +++ b/compiler-rt/lib/hwasan/hwasan_allocator.h @@ -28,8 +28,8 @@ namespace __hwasan { struct Metadata { - u32 requested_size : 31; // sizes are < 2G. - u32 right_aligned : 1; + u64 requested_size : 63; + u64 right_aligned : 1; u32 alloc_context_id; }; @@ -43,7 +43,7 @@ } }; -static const uptr kMaxAllowedMallocSize = 2UL << 30; // 2G +static const uptr kMaxAllowedMallocSize = 1UL << 40; // 1T struct AP64 { static const uptr kSpaceBeg = ~0ULL; diff --git a/compiler-rt/test/hwasan/TestCases/allocator_returns_null.cpp b/compiler-rt/test/hwasan/TestCases/allocator_returns_null.cpp --- a/compiler-rt/test/hwasan/TestCases/allocator_returns_null.cpp +++ b/compiler-rt/test/hwasan/TestCases/allocator_returns_null.cpp @@ -55,7 +55,7 @@ const char *action = argv[1]; untag_fprintf(stderr, "%s:\n", action); - static const size_t kMaxAllowedMallocSizePlusOne = (2UL << 30) + 1; + static const size_t kMaxAllowedMallocSizePlusOne = (1UL << 40) + 1; void *x = nullptr; if (!untag_strcmp(action, "malloc")) { diff --git a/compiler-rt/test/hwasan/TestCases/sizes.cpp b/compiler-rt/test/hwasan/TestCases/sizes.cpp --- a/compiler-rt/test/hwasan/TestCases/sizes.cpp +++ b/compiler-rt/test/hwasan/TestCases/sizes.cpp @@ -44,7 +44,7 @@ static const size_t kChunkHeaderSize = 16; size_t MallocSize = test_size_max ? std::numeric_limits::max() - : kMaxAllowedMallocSize; + : (kMaxAllowedMallocSize + 1); if (!untag_strcmp(argv[1], "malloc")) { void *p = malloc(MallocSize);