From 0b981f54e69d9c4efb64460b5671fa6513fb9102 Mon Sep 17 00:00:00 2001 From: Florian Mayer Date: Wed, 16 Feb 2022 23:46:53 +0000 Subject: [PATCH] Reland^2 "Enable hwasan use after scope detection." This CL enables HWASan to detect a new class of bugs, specifically use-after-scope. An example for a bug like this is int* y; { int x = 1; y = &x; } *y = 2; IF YOU FOUND THIS CL AS A POSSIBLE CULPRIT OF A TEST FAILURE: While it is possible that there is a bug in HWASan and this CL needs to be rolled back, please also consider that this might surface actual problems in either the test code or the code under test. See https://r.android.com/1956922 for an example of fix for a bug detected by a previous rollout of this flag. This reverts commit fd337b3963ab29529e01450b2cdc32541fca3625. Reason for revert: Once https://r.android.com/1985009 is submitted the bug that caused the revert will be fixed. Change-Id: Id9e81e8b7c26e044af00bdaeae6bb35abbbd9710 --- cc/sanitize.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cc/sanitize.go b/cc/sanitize.go index b8e1468e4..53c0f4a5f 100644 --- a/cc/sanitize.go +++ b/cc/sanitize.go @@ -42,6 +42,7 @@ var ( "-fno-omit-frame-pointer", "-Wno-frame-larger-than=", "-fsanitize-hwaddress-abi=platform", + "-mllvm", "-hwasan-use-after-scope=1", } // ThinLTO performs codegen during link time, thus these flags need to