diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2016-07-01 04:26:26 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-07-01 04:26:26 +0000 |
commit | 9d73af09346247352cd3eea8bbc857432ced6c32 (patch) | |
tree | 88654309da60b5b4857642e20ea8213fe990a609 | |
parent | 2302a76966e1e154fb4cfe38eb308b5be6c471d0 (diff) | |
parent | 6b30d770f025de95cb9f3f3df70d56d4d3291470 (diff) | |
download | build-9d73af09346247352cd3eea8bbc857432ced6c32.tar.gz |
Merge changes I17a96b97,Ib4412657,I73e6d479
* changes:
Build: Add module-level product configuration of sanitization
Build: Add option to restrict sanitization by owner
Build: Add option to restrict sanitization by architecture
-rw-r--r-- | core/config_sanitizers.mk | 25 | ||||
-rw-r--r-- | core/product.mk | 12 | ||||
-rw-r--r-- | core/product_config.mk | 16 |
3 files changed, 52 insertions, 1 deletions
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk index b69a6ce20b..18b74783a5 100644 --- a/core/config_sanitizers.mk +++ b/core/config_sanitizers.mk @@ -24,6 +24,31 @@ ifneq ($(my_global_sanitize),) my_sanitize := $(my_global_sanitize) endif +# The sanitizer specified in the product configuration wins over the previous. +ifneq ($(SANITIZER.$(TARGET_PRODUCT).$(LOCAL_MODULE).CONFIG),) + my_sanitize := $(SANITIZER.$(TARGET_PRODUCT).$(LOCAL_MODULE).CONFIG) + ifeq ($(my_sanitize),never) + my_sanitize := + endif +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 + +# 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 := diff --git a/core/product.mk b/core/product.mk index 8f3fcb840f..7dfaa1909b 100644 --- a/core/product.mk +++ b/core/product.mk @@ -120,6 +120,7 @@ _product_var_list := \ PRODUCT_DEX_PREOPT_MODULE_CONFIGS \ PRODUCT_DEX_PREOPT_DEFAULT_FLAGS \ PRODUCT_DEX_PREOPT_BOOT_FLAGS \ + PRODUCT_SANITIZER_MODULE_CONFIGS \ PRODUCT_SHIPPING_API_LEVEL \ VENDOR_PRODUCT_RESTRICT_VENDOR_FILES \ VENDOR_EXCEPTION_MODULES \ @@ -333,3 +334,14 @@ $(eval _c := $(subst $(space),$(_PDPMC_SP_PLACE_HOLDER),$(strip $(2))))\ $(eval PRODUCT_DEX_PREOPT_MODULE_CONFIGS += \ $(foreach m,$(1),$(m)=$(_c))) endef + +# whitespace placeholder when we record module's sanitizer config. +_PSMC_SP_PLACE_HOLDER := |@SP@| +# Set up sanitizer config for a module. +# $(1) list of module names +# $(2) the modules' sanitizer config +define add-product-sanitizer-module-config +$(eval _c := $(subst $(space),$(_PSMC_SP_PLACE_HOLDER),$(strip $(2))))\ +$(eval PRODUCT_SANITIZER_MODULE_CONFIGS += \ + $(foreach m,$(1),$(m)=$(_c))) +endef diff --git a/core/product_config.mk b/core/product_config.mk index a4063f1ee6..f00f4cd1ae 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -390,7 +390,7 @@ PRODUCT_DEX_PREOPT_DEFAULT_FLAGS := \ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_DEFAULT_FLAGS)) PRODUCT_DEX_PREOPT_BOOT_FLAGS := \ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_BOOT_FLAGS)) -# Resolve and setup per-module dex-preopot configs. +# Resolve and setup per-module dex-preopt configs. PRODUCT_DEX_PREOPT_MODULE_CONFIGS := \ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_MODULE_CONFIGS)) # If a module has multiple setups, the first takes precedence. @@ -403,3 +403,17 @@ $(foreach c,$(PRODUCT_DEX_PREOPT_MODULE_CONFIGS),\ $(eval cf := $(subst $(_PDPMC_SP_PLACE_HOLDER),$(space),$(cf)))\ $(eval DEXPREOPT.$(TARGET_PRODUCT).$(m).CONFIG := $(cf)))) _pdpmc_modules := + +# Resolve and setup per-module sanitizer configs. +PRODUCT_SANITIZER_MODULE_CONFIGS := \ + $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SANITIZER_MODULE_CONFIGS)) +# If a module has multiple setups, the first takes precedence. +_psmc_modules := +$(foreach c,$(PRODUCT_SANITIZER_MODULE_CONFIGS),\ + $(eval m := $(firstword $(subst =,$(space),$(c))))\ + $(if $(filter $(_psmc_modules),$(m)),,\ + $(eval _psmc_modules += $(m))\ + $(eval cf := $(patsubst $(m)=%,%,$(c)))\ + $(eval cf := $(subst $(_PSMC_SP_PLACE_HOLDER),$(space),$(cf)))\ + $(eval SANITIZER.$(TARGET_PRODUCT).$(m).CONFIG := $(cf)))) +_psmc_modules := |