[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:47:54 PDT 2020


eugenis updated this revision to Diff 299221.
eugenis added a comment.

.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D89750/new/

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
@@ -27,9 +27,9 @@
 
 namespace __hwasan {
 
-struct Metadata {
-  u32 requested_size : 31;  // sizes are < 2G.
-  u32 right_aligned  : 1;
+struct __attribute__((packed)) Metadata {
+  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.299221.patch
Type: text/x-patch
Size: 1818 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201019/5bef62d9/attachment.bin>


More information about the llvm-commits mailing list