Add option to disable Scudo globally [Make]

This adds an option to turn off Scudo globally, and use it for Go.

Bug: 123228023
Test: verify that Scudo is disabled for a Go build, eg:
lunch marlin_svelte-eng && m -j, check that Scudo is not linked in
out/target/product/marlin/system/bin/mediaextractor
Test: verify that Scudo is enabled otherwise, eg:
lunch marlin-eng && m -j, check that Scudo is linked in
out/target/product/marlin/system/bin/mediaextractor

Change-Id: Idc82d581fade544a474e6f2ff0b54dd191ba0818
Merged-In: Idc82d581fade544a474e6f2ff0b54dd191ba0818
This commit is contained in:
Kostya Kortchinsky 2019-02-01 09:06:42 -08:00
parent 20258b55b6
commit 027324099f
5 changed files with 17 additions and 0 deletions

View File

@ -213,6 +213,11 @@ ifneq ($(filter address thread hwaddress,$(my_sanitize)),)
my_sanitize := $(filter-out scudo,$(my_sanitize))
endif
# Or if disabled globally.
ifeq ($(strip $(PRODUCT_DISABLE_SCUDO)),true)
my_sanitize := $(filter-out scudo,$(my_sanitize))
endif
# Undefined symbols can occur if a non-sanitized library links
# sanitized static libraries. That's OK, because the executable
# always depends on the ASan runtime library, which defines these

View File

@ -201,6 +201,7 @@ _product_var_list := \
PRODUCT_ADB_KEYS \
PRODUCT_CFI_INCLUDE_PATHS \
PRODUCT_CFI_EXCLUDE_PATHS \
PRODUCT_DISABLE_SCUDO \
PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE \
PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE \
PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS \

View File

@ -512,6 +512,10 @@ PRODUCT_CFI_EXCLUDE_PATHS := \
PRODUCT_CFI_INCLUDE_PATHS := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_CFI_INCLUDE_PATHS))
# Whether the Scudo hardened allocator is disabled platform-wide
PRODUCT_DISABLE_SCUDO := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DISABLE_SCUDO))
# Whether any paths are excluded from being set XOM when ENABLE_XOM=true
PRODUCT_XOM_EXCLUDE_PATHS := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_XOM_EXCLUDE_PATHS))

View File

@ -87,6 +87,8 @@ $(call add_json_bool, EnableXOM, $(call invert_bool,$(fi
$(call add_json_list, XOMExcludePaths, $(XOM_EXCLUDE_PATHS) $(PRODUCT_XOM_EXCLUDE_PATHS))
$(call add_json_list, IntegerOverflowExcludePaths, $(INTEGER_OVERFLOW_EXCLUDE_PATHS) $(PRODUCT_INTEGER_OVERFLOW_EXCLUDE_PATHS))
$(call add_json_bool, DisableScudo, $(filter true,$(PRODUCT_DISABLE_SCUDO)))
$(call add_json_bool, ClangTidy, $(filter 1 true,$(WITH_TIDY)))
$(call add_json_str, TidyChecks, $(WITH_TIDY_CHECKS))

View File

@ -69,3 +69,8 @@ PRODUCT_SYSTEM_SERVER_JARS += NetworkStackLib
# the size of the system image. This has no bearing on stack traces, but will
# leave less information available via JDWP.
PRODUCT_MINIMIZE_JAVA_DEBUG_INFO := true
# Disable Scudo outside of eng builds to save RAM.
ifneq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
PRODUCT_DISABLE_SCUDO := true
endif