From 0290a416c844f9a8ec953f63f199b00d36283228 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Mon, 20 Jun 2016 17:36:49 -0700 Subject: [PATCH 1/2] Build: Add option to restrict sanitization by architecture Add Make variable SANITIZE_ARCH to selectively sanitize binaries. This uses the "bitness," i.e., 32 or 64, to potentially filter the sanitization. By default, both are being sanitized. This can be used to create builds that lower the sanitization burden by not sanitizing "half" of the platform. Bug: 29498013 Change-Id: I73e6d479f08a970ba912f4f63967d32f3487125f --- core/config_sanitizers.mk | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk index 6e968808ce..524a065e27 100644 --- a/core/config_sanitizers.mk +++ b/core/config_sanitizers.mk @@ -24,6 +24,12 @@ ifneq ($(my_global_sanitize),) my_sanitize := $(my_global_sanitize) endif +# Add a filter point for 32-bit vs 64-bit sanitization (to lighten the burden). +SANITIZE_ARCH ?= 32 64 +ifeq ($(filter $(SANITIZE_ARCH),$(my_32_64_bit_suffix)),) + my_sanitize := +endif + # Don't apply sanitizers to NDK code. ifdef LOCAL_SDK_VERSION my_sanitize := From ea38d8e95d7daea49cc2a528d69e06a0005b31a6 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Mon, 20 Jun 2016 17:46:29 -0700 Subject: [PATCH 2/2] Build: Add option to restrict sanitization by owner Add Make variable SANITIZE_NEVER_BY_OWNER to selectively sanitize modules. By default, both are being sanitized. The value of the variable is interpreted as a space or colon separated list of owner names. This can be used to create builds that lower the sanitization burden by not sanitizing parts of the platform. Bug: 29498013 Change-Id: Ib4412657fd38ff28a5c0863eddc2acde63c88ebb --- core/config_sanitizers.mk | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk index 524a065e27..f84a66f0f3 100644 --- a/core/config_sanitizers.mk +++ b/core/config_sanitizers.mk @@ -30,6 +30,17 @@ ifeq ($(filter $(SANITIZE_ARCH),$(my_32_64_bit_suffix)),) my_sanitize := endif +# Add a filter point based on module owner (to lighten the burden). The format is a space- or +# colon-separated list of owner names. +ifneq (,$(SANITIZE_NEVER_BY_OWNER)) + ifneq (,$(LOCAL_MODULE_OWNER)) + ifneq (,$(filter $(LOCAL_MODULE_OWNER),$(subst :, ,$(SANITIZE_NEVER_BY_OWNER)))) + $(warning Not sanitizing $(LOCAL_MODULE) based on module owner.) + my_sanitize := + endif + endif +endif + # Don't apply sanitizers to NDK code. ifdef LOCAL_SDK_VERSION my_sanitize :=