[PATCH] D53789: [hwasan] optionally right-align heap allocations

Dmitry Vyukov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 27 01:19:37 PDT 2018


dvyukov added inline comments.


================
Comment at: lib/hwasan/hwasan_allocator.cc:136
 
+  if (orig_size % kShadowAlignment) {
+    if (int malloc_align_right = flags()->malloc_align_right) {
----------------
Shouldn't we also look at user-requested alignment here? It looks like we only satisfy natural alignment.


================
Comment at: test/hwasan/TestCases/heap-buffer-overflow.c:28
   x[offset] = 42;
-// CHECK40: allocated heap chunk; size: 32 offset: 8
+// CHECK40: allocated heap chunk; size: 32 offset: {{8|10}}
 // CHECK40: is located 10 bytes to the right of 30-byte region
----------------
This won't catch regressions as it will be happy with 8 in all cases.


================
Comment at: test/hwasan/TestCases/heap-buffer-overflow.c:31
 //
-// CHECK80: allocated heap chunk; size: 32 offset: 16
+// CHECK80: allocated heap chunk; size: 32 offset: {{16|18}}
 // CHECK80: is located 50 bytes to the right of 30-byte region
----------------
Ditto.


================
Comment at: test/hwasan/TestCases/heap-buffer-overflow.c:34
 //
-// CHECKm30: allocated heap chunk; size: 32 offset: 2
+// CHECKm30: allocated heap chunk; size: 32 offset: {{2|4}}
 // CHECKm30: is located 30 bytes to the left of 30-byte region
----------------
Ditto.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D53789





More information about the llvm-commits mailing list