From 1e79844f157d412ee37757d17381ee5e4d452d66 Mon Sep 17 00:00:00 2001 From: Evgenii Stepanov Date: Thu, 15 Nov 2018 17:34:18 -0800 Subject: [PATCH] Apply HWASan to libc-in-recovery. HWASan is disabled in recovery strictly for code size, not for correctness. With this change, HWASan binaries and libraries can be used in recovery. The real reason is the make build system which has no idea of the big picture, and makes it hard to disable HWASan in _all_ recovery modules recursively. A few static libraries have sneaked in. Bug: 119582521 Test: sideload an OTA onto a hwasan device Change-Id: I6536cc7bf5bfb37f939b585545a23c2068fbd47f --- cc/sanitize.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cc/sanitize.go b/cc/sanitize.go index cd3b3e901..5ca5e5e0b 100644 --- a/cc/sanitize.go +++ b/cc/sanitize.go @@ -299,7 +299,8 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) { } // HWASan ramdisk (which is built from recovery) goes over some bootloader limit. - if ctx.inRecovery() { + // Keep libc instrumented so that recovery can run hwasan-instrumented code if necessary. + if ctx.inRecovery() && !strings.HasPrefix(ctx.ModuleDir(), "bionic/libc") { s.Hwaddress = nil }