forked from openkylin/platform_build
Add support of SANITIZE_TARGET='address coverage' for fuzzing.
Also, add trace-cmp instrumentation to fuzz_test and host_fuzz_test. Bug: 22850550 Change-Id: Ifff7b8be693ae991feb0a64e19439370a19b2748
This commit is contained in:
parent
3ee9daac6a
commit
74b32b8dfc
|
@ -1383,7 +1383,7 @@ built_ota_tools := \
|
|||
$(call intermediates-dir-for,EXECUTABLES,sqlite3,,,$(TARGET_PREFER_32_BIT))/sqlite3
|
||||
|
||||
# We can't build static executables when SANITIZE_TARGET=address
|
||||
ifneq (address,$(SANITIZE_TARGET))
|
||||
ifeq ($(strip $(SANITIZE_TARGET)),)
|
||||
built_ota_tools += \
|
||||
$(call intermediates-dir-for,EXECUTABLES,check_prereq,,,$(TARGET_PREFER_32_BIT))/check_prereq \
|
||||
$(call intermediates-dir-for,EXECUTABLES,applypatch_static,,,$(TARGET_PREFER_32_BIT))/applypatch_static \
|
||||
|
@ -1526,7 +1526,7 @@ ifneq ($(OEM_THUMBPRINT_PROPERTIES),)
|
|||
# OTA scripts are only interested in fingerprint related properties
|
||||
$(hide) echo "oem_fingerprint_properties=$(OEM_THUMBPRINT_PROPERTIES)" >> $(zip_root)/META/misc_info.txt
|
||||
endif
|
||||
ifeq ($(SANITIZE_TARGET),address)
|
||||
ifneq ($(strip $(SANITIZE_TARGET)),)
|
||||
# We need to create userdata.img with real data because the instrumented libraries are in userdata.img.
|
||||
$(hide) echo "userdata_img_with_data=true" >> $(zip_root)/META/misc_info.txt
|
||||
endif
|
||||
|
@ -1565,7 +1565,7 @@ build_ota_package := true
|
|||
ifeq ($(BUILD_OS),darwin)
|
||||
build_ota_package := false
|
||||
endif
|
||||
ifeq ($(SANITIZE_TARGET),address)
|
||||
ifneq ($(strip $(SANITIZE_TARGET)),)
|
||||
build_ota_package := false
|
||||
endif
|
||||
ifeq ($(TARGET_PRODUCT),sdk)
|
||||
|
|
|
@ -75,6 +75,14 @@ ifneq ($(filter default-ub,$(my_sanitize)),)
|
|||
my_sanitize := $(CLANG_DEFAULT_UB_CHECKS)
|
||||
endif
|
||||
|
||||
ifneq ($(filter coverage,$(my_sanitize)),)
|
||||
ifeq ($(filter address,$(my_sanitize)),)
|
||||
$(error $(LOCAL_PATH): $(LOCAL_MODULE): Use of 'coverage' also requires 'address')
|
||||
endif
|
||||
my_cflags += -fsanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp
|
||||
my_sanitize := $(filter-out coverage,$(my_sanitize))
|
||||
endif
|
||||
|
||||
ifneq ($(my_sanitize),)
|
||||
fsanitize_arg := $(subst $(space),$(comma),$(my_sanitize)),
|
||||
my_cflags += -fsanitize=$(fsanitize_arg)
|
||||
|
|
|
@ -276,7 +276,7 @@ TARGET_OUT_GEN := $(PRODUCT_OUT)/gen
|
|||
TARGET_OUT_COMMON_GEN := $(TARGET_COMMON_OUT_ROOT)/gen
|
||||
|
||||
TARGET_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM)
|
||||
ifeq ($(SANITIZE_TARGET),address)
|
||||
ifneq ($(filter address,$(SANITIZE_TARGET)),)
|
||||
target_out_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_DATA)
|
||||
else
|
||||
target_out_shared_libraries_base := $(TARGET_OUT)
|
||||
|
@ -333,7 +333,7 @@ $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_DATA_NATIVE_TESTS := $(TARGET_OUT_DATA)/
|
|||
TARGET_OUT_CACHE := $(PRODUCT_OUT)/cache
|
||||
|
||||
TARGET_OUT_VENDOR := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR)
|
||||
ifeq ($(SANITIZE_TARGET),address)
|
||||
ifneq ($(filter address,$(SANITIZE_TARGET)),)
|
||||
target_out_vendor_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_DATA)/vendor
|
||||
else
|
||||
target_out_vendor_shared_libraries_base := $(TARGET_OUT_VENDOR)
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
# LOCAL_MODULE_STEM_64
|
||||
|
||||
my_skip_this_target :=
|
||||
ifeq (address,$(strip $(SANITIZE_TARGET)))
|
||||
ifneq ($(filter address,$(SANITIZE_TARGET)),)
|
||||
ifeq (true,$(LOCAL_FORCE_STATIC_EXECUTABLE))
|
||||
my_skip_this_target := true
|
||||
else ifeq (false, $(LOCAL_CLANG))
|
||||
|
|
|
@ -7,7 +7,7 @@ ifdef LOCAL_SDK_VERSION
|
|||
$(error $(LOCAL_PATH): $(LOCAL_MODULE): NDK fuzz tests are not supported.)
|
||||
endif
|
||||
|
||||
LOCAL_CFLAGS += -fsanitize-coverage=edge,indirect-calls,8bit-counters
|
||||
LOCAL_CFLAGS += -fsanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp
|
||||
LOCAL_STATIC_LIBRARIES += libLLVMFuzzer
|
||||
|
||||
ifdef LOCAL_MODULE_PATH
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
## Common flags for host fuzz tests are added.
|
||||
################################################
|
||||
|
||||
LOCAL_CFLAGS += -fsanitize-coverage=edge,indirect-calls,8bit-counters
|
||||
LOCAL_CFLAGS += -fsanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp
|
||||
LOCAL_STATIC_LIBRARIES += libLLVMFuzzer
|
||||
|
||||
include $(BUILD_HOST_EXECUTABLE)
|
||||
|
|
Loading…
Reference in New Issue