Disable malloc fill in HWASan.
HWASan has a feature to fill malloc() memory with non-zero pattern.
This has found a bug or two in the past, but it also keep causing hard
to debug issues. The main problem is lack of diagnostics - use of
pattern-initialized memory is not an immediate crash. More often than
not it manifests as a subtle change in system behavior.
Having MemorySanitizer on Android would be nice...
This change does not affect any shipping configuration, but improves
stability of testing-only SANITIZE_TARGET=hwaddress build.
Bug: 132803232
Bug: 132652537
Bug: 131438232
Bug: 132810685
Test: SANITIZE_TARGET=hwasan on crosshatch successfully boots in ~100%
attempt (up from ~99% currently).
Change-Id: I7dcbcdf1b8a5b8556e32690327b32f04879e5db1
diff --git a/cc/sanitize.go b/cc/sanitize.go
index ef60b8e..89ef7e6 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -57,7 +57,8 @@
minimalRuntimeFlags = []string{"-fsanitize-minimal-runtime", "-fno-sanitize-trap=integer,undefined",
"-fno-sanitize-recover=integer,undefined"}
- hwasanGlobalOptions = []string{"heap_history_size=1023,stack_history_size=512,export_memory_stats=0"}
+ hwasanGlobalOptions = []string{"heap_history_size=1023", "stack_history_size=512",
+ "export_memory_stats=0", "max_malloc_fill_size=0"}
)
type sanitizerType int