[hwasan] Disable malloc-fill by default.
authorEvgenii Stepanov <eugenis@google.com>
Fri, 5 Jun 2020 17:57:44 +0000 (10:57 -0700)
committerEvgenii Stepanov <eugenis@google.com>
Fri, 5 Jun 2020 18:27:16 +0000 (11:27 -0700)
Summary: Non-zero malloc fill is causing way too many hard to debug issues.

Reviewers: kcc, pcc, hctim

Subscribers: #sanitizers, llvm-commits

Tags: #sanitizers

Differential Revision: https://reviews.llvm.org/D81284

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

index dffbf56..8e431d9 100644 (file)
@@ -33,7 +33,7 @@ HWASAN_FLAG(bool, disable_allocator_tagging, false, "")
 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.")
 
index 96033ef..27e28c7 100644 (file)
@@ -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 @@ int main(int argc, char **argv) {
   delete [] x;
 }
 
-// CHECK: -bebebebebebebebebebebebebebebebebebebebebebebebebebebebebebebebebe-
+// CHECK-0: -000000000000000000000000000000000000000000000000000000000000000000-
+// CHECK-20-be: -bebebebebebebebebebebebebebebebebebebebe00000000000000000000000000-
 // CHECK-10-8: -080808080808080808080000000000000000000000000000000000000000000000-
 // CHECK-20-ab: -abababababababababababababababababababab00000000000000000000000000-