diff --git a/compiler-rt/lib/hwasan/hwasan_flags.inc b/compiler-rt/lib/hwasan/hwasan_flags.inc --- a/compiler-rt/lib/hwasan/hwasan_flags.inc +++ b/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.") diff --git a/compiler-rt/test/hwasan/TestCases/malloc_fill.cpp b/compiler-rt/test/hwasan/TestCases/malloc_fill.cpp --- 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 @@ delete [] x; } -// CHECK: -bebebebebebebebebebebebebebebebebebebebebebebebebebebebebebebebebe- +// CHECK-0: -000000000000000000000000000000000000000000000000000000000000000000- +// CHECK-20-be: -bebebebebebebebebebebebebebebebebebebebe00000000000000000000000000- // CHECK-10-8: -080808080808080808080000000000000000000000000000000000000000000000- // CHECK-20-ab: -abababababababababababababababababababab00000000000000000000000000-