From 5fb2de70868698c6e319e330046436113ff634ee Mon Sep 17 00:00:00 2001 From: Ivan Lozano Date: Wed, 12 Dec 2018 10:04:34 -0800 Subject: [PATCH] Add make var to avoid recovering with diagnostics. Add a LOCAL_SANITIZE_NO_RECOVER variable that allows specifying which sanitizers running in diagnostics mode shouldn't recover. This can help debugging as we test enabling sanitizers in new libraries since it'll cause tombstones to be generated along with the diagnostics information. Bug: 80195448 Bug: 110791537 Test: Compiled test module with this flag, checked compiler command. Test: Test module crashed, tombstone contained diagnostics information. Change-Id: I441b9c873e54bf6404325f4d0ac59835350c2889 --- core/clear_vars.mk | 1 + core/config_sanitizers.mk | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/core/clear_vars.mk b/core/clear_vars.mk index 0417e1389a..799425f156 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -248,6 +248,7 @@ LOCAL_RTTI_FLAG:= LOCAL_SANITIZE:= LOCAL_SANITIZE_DIAG:= LOCAL_SANITIZE_RECOVER:= +LOCAL_SANITIZE_NO_RECOVER:= LOCAL_SANITIZE_BLACKLIST := LOCAL_SDK_LIBRARIES := LOCAL_SDK_RES_VERSION:= diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk index 7b4015e197..51b859ed8c 100644 --- a/core/config_sanitizers.mk +++ b/core/config_sanitizers.mk @@ -401,6 +401,11 @@ ifneq ($(strip $(LOCAL_SANITIZE_RECOVER)),) my_cflags += -fsanitize-recover=$(recover_arg) endif +ifneq ($(strip $(LOCAL_SANITIZE_NO_RECOVER)),) + no_recover_arg := $(subst $(space),$(comma),$(LOCAL_SANITIZE_NO_RECOVER)), + my_cflags += -fno-sanitize-recover=$(no_recover_arg) +endif + ifneq ($(my_sanitize_diag),) # TODO(vishwath): Add diagnostic support for static executables once # we switch to clang-4393122 (which adds the static ubsan runtime