[PATCH] D81284: [hwasan] Disable malloc-fill by default.

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 5 11:11:04 PDT 2020


eugenis created this revision.
eugenis added reviewers: kcc, pcc, hctim.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.
eugenis added a subscriber: srhines.

Non-zero malloc fill is causing way too many hard to debug issues.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81284

Files:
  compiler-rt/lib/hwasan/hwasan_flags.inc
  compiler-rt/test/hwasan/TestCases/malloc_fill.cpp


Index: compiler-rt/test/hwasan/TestCases/malloc_fill.cpp
===================================================================
--- compiler-rt/test/hwasan/TestCases/malloc_fill.cpp
+++ compiler-rt/test/hwasan/TestCases/malloc_fill.cpp
@@ -1,6 +1,8 @@
 // Check that we fill malloc-ed memory correctly.
 // RUN: %clangxx_hwasan %s -o %t
-// RUN: %run %t | FileCheck %s
+// RUN: %run %t | FileCheck %s --check-prefix=CHECK-0
+// RUN: %env_hwasan_opts=max_malloc_fill_size=20 %run %t | FileCheck %s --check-prefix=CHECK-20-be
+// RUN: %env_hwasan_opts=max_malloc_fill_size=0:malloc_fill_byte=8 %run %t | FileCheck %s --check-prefix=CHECK-0
 // RUN: %env_hwasan_opts=max_malloc_fill_size=10:malloc_fill_byte=8 %run %t | FileCheck %s --check-prefix=CHECK-10-8
 // RUN: %env_hwasan_opts=max_malloc_fill_size=20:malloc_fill_byte=171 %run %t | FileCheck %s --check-prefix=CHECK-20-ab
 
@@ -20,6 +22,7 @@
   delete [] x;
 }
 
-// CHECK: -bebebebebebebebebebebebebebebebebebebebebebebebebebebebebebebebebe-
+// CHECK-0: -000000000000000000000000000000000000000000000000000000000000000000-
+// CHECK-20-be: -bebebebebebebebebebebebebebebebebebebebe00000000000000000000000000-
 // CHECK-10-8: -080808080808080808080000000000000000000000000000000000000000000000-
 // CHECK-20-ab: -abababababababababababababababababababab00000000000000000000000000-
Index: compiler-rt/lib/hwasan/hwasan_flags.inc
===================================================================
--- compiler-rt/lib/hwasan/hwasan_flags.inc
+++ compiler-rt/lib/hwasan/hwasan_flags.inc
@@ -33,7 +33,7 @@
 HWASAN_FLAG(bool, random_tags, true, "")
 
 HWASAN_FLAG(
-    int, max_malloc_fill_size, 0x1000,  // By default, fill only the first 4K.
+    int, max_malloc_fill_size, 0,
     "HWASan allocator flag. max_malloc_fill_size is the maximal amount of "
     "bytes that will be filled with malloc_fill_byte on malloc.")
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81284.268882.patch
Type: text/x-patch
Size: 1874 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200605/4ba7f3fb/attachment.bin>


More information about the llvm-commits mailing list