[PATCH] D89750: [hwasan] Increase max allocation size to 1Tb.

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 19 16:40:38 PDT 2020


eugenis created this revision.
eugenis added reviewers: pcc, hctim.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.
eugenis requested review of this revision.

2Gb is unreasonably low on devices with 12Gb RAM and more.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D89750

Files:
  compiler-rt/lib/hwasan/hwasan_allocator.h
  compiler-rt/test/hwasan/TestCases/allocator_returns_null.cpp
  compiler-rt/test/hwasan/TestCases/sizes.cpp


Index: compiler-rt/test/hwasan/TestCases/sizes.cpp
===================================================================
--- compiler-rt/test/hwasan/TestCases/sizes.cpp
+++ 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<size_t>::max()
-                                    : kMaxAllowedMallocSize;
+                                    : (kMaxAllowedMallocSize + 1);
 
   if (!untag_strcmp(argv[1], "malloc")) {
     void *p = malloc(MallocSize);
Index: compiler-rt/test/hwasan/TestCases/allocator_returns_null.cpp
===================================================================
--- compiler-rt/test/hwasan/TestCases/allocator_returns_null.cpp
+++ 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")) {
Index: compiler-rt/lib/hwasan/hwasan_allocator.h
===================================================================
--- compiler-rt/lib/hwasan/hwasan_allocator.h
+++ 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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89750.299216.patch
Type: text/x-patch
Size: 1773 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201019/77c5fcd4/attachment.bin>


More information about the llvm-commits mailing list