[compiler-rt] d1a6e4d - [hwasan] Disable malloc-fill by default.

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


Author: Evgenii Stepanov
Date: 2020-06-05T11:27:16-07:00
New Revision: d1a6e4d2db493c0ce27ccba7f287acfeac1776a6

URL: https://github.com/llvm/llvm-project/commit/d1a6e4d2db493c0ce27ccba7f287acfeac1776a6
DIFF: https://github.com/llvm/llvm-project/commit/d1a6e4d2db493c0ce27ccba7f287acfeac1776a6.diff

LOG: [hwasan] Disable malloc-fill by default.

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/hwasan/hwasan_flags.inc b/compiler-rt/lib/hwasan/hwasan_flags.inc
index dffbf56cb155..8e431d9c4ff9 100644
--- a/compiler-rt/lib/hwasan/hwasan_flags.inc
+++ b/compiler-rt/lib/hwasan/hwasan_flags.inc
@@ -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.")
 

diff  --git a/compiler-rt/test/hwasan/TestCases/malloc_fill.cpp b/compiler-rt/test/hwasan/TestCases/malloc_fill.cpp
index 96033ef38f9f..27e28c700071 100644
--- a/compiler-rt/test/hwasan/TestCases/malloc_fill.cpp
+++ b/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 @@ 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-


        


More information about the llvm-commits mailing list