system/corennnnn
修訂 | 8ccc1ad0f71d0587edfbc4c637d6d8de196fe7df (tree) |
---|---|
時間 | 2016-06-24 06:45:35 |
作者 | Andreas Gampe <agampe@goog...> |
Commiter | Andreas Gampe |
Rootdir: Add more asan.options support
Extend the asan.options file to read binary-specific configuration
from files out of /system. For early services, the system image
location is important as /data may not be available when they are
started.
Add a template that turns most sanitization off. At this point in
time, it is, however, impossible to get to a zero overhead state
after the fact. The template is meant to adapt a build after the
fact, and work around issues with LOCAL_SANITIZE := never.
Add a Make variable and rule copying the template to the path and
name expected by ASAN. Add SANITIZE_LITE to automatically add a
large set of options files.
Bug: 29498013
Change-Id: I8e9e6929a55cee3f3fa0acb377a886bfa7006c91
@@ -26,6 +26,7 @@ include $(BUILD_PREBUILT) | ||
26 | 26 | ####################################### |
27 | 27 | # asan.options |
28 | 28 | ifneq ($(filter address,$(SANITIZE_TARGET)),) |
29 | + | |
29 | 30 | include $(CLEAR_VARS) |
30 | 31 | |
31 | 32 | LOCAL_MODULE := asan.options |
@@ -34,6 +35,72 @@ LOCAL_SRC_FILES := $(LOCAL_MODULE) | ||
34 | 35 | LOCAL_MODULE_PATH := $(TARGET_OUT) |
35 | 36 | |
36 | 37 | include $(BUILD_PREBUILT) |
38 | + | |
39 | +# Modules for asan.options.X files. | |
40 | + | |
41 | +ASAN_OPTIONS_FILES := | |
42 | + | |
43 | +define create-asan-options-module | |
44 | +include $$(CLEAR_VARS) | |
45 | +LOCAL_MODULE := asan.options.$(1) | |
46 | +ASAN_OPTIONS_FILES += asan.options.$(1) | |
47 | +LOCAL_MODULE_CLASS := ETC | |
48 | +# The asan.options.off.template tries to turn off as much of ASAN as is possible. | |
49 | +LOCAL_SRC_FILES := asan.options.off.template | |
50 | +LOCAL_MODULE_PATH := $(TARGET_OUT) | |
51 | +include $$(BUILD_PREBUILT) | |
52 | +endef | |
53 | + | |
54 | +# Pretty comprehensive set of native services. This list is helpful if all that's to be checked is an | |
55 | +# app. | |
56 | +ifeq ($(SANITIZE_LITE),true) | |
57 | +SANITIZE_ASAN_OPTIONS_FOR := \ | |
58 | + adbd \ | |
59 | + ATFWD-daemon \ | |
60 | + audioserver \ | |
61 | + bridgemgrd \ | |
62 | + cameraserver \ | |
63 | + cnd \ | |
64 | + debuggerd \ | |
65 | + debuggerd64 \ | |
66 | + dex2oat \ | |
67 | + drmserver \ | |
68 | + fingerprintd \ | |
69 | + gatekeeperd \ | |
70 | + installd \ | |
71 | + keystore \ | |
72 | + lmkd \ | |
73 | + logcat \ | |
74 | + logd \ | |
75 | + lowi-server \ | |
76 | + media.codec \ | |
77 | + mediadrmserver \ | |
78 | + media.extractor \ | |
79 | + mediaserver \ | |
80 | + mm-qcamera-daemon \ | |
81 | + mpdecision \ | |
82 | + netmgrd \ | |
83 | + perfd \ | |
84 | + perfprofd \ | |
85 | + qmuxd \ | |
86 | + qseecomd \ | |
87 | + rild \ | |
88 | + sdcard \ | |
89 | + servicemanager \ | |
90 | + slim_daemon \ | |
91 | + surfaceflinger \ | |
92 | + thermal-engine \ | |
93 | + time_daemon \ | |
94 | + update_engine \ | |
95 | + vold \ | |
96 | + wpa_supplicant \ | |
97 | + zip | |
98 | +endif | |
99 | + | |
100 | +ifneq ($(SANITIZE_ASAN_OPTIONS_FOR),) | |
101 | + $(foreach binary, $(SANITIZE_ASAN_OPTIONS_FOR), $(eval $(call create-asan-options-module,$(binary)))) | |
102 | +endif | |
103 | + | |
37 | 104 | endif |
38 | 105 | |
39 | 106 | ####################################### |
@@ -47,7 +114,7 @@ LOCAL_MODULE_PATH := $(TARGET_ROOT_OUT) | ||
47 | 114 | EXPORT_GLOBAL_ASAN_OPTIONS := |
48 | 115 | ifneq ($(filter address,$(SANITIZE_TARGET)),) |
49 | 116 | EXPORT_GLOBAL_ASAN_OPTIONS := export ASAN_OPTIONS include=/system/asan.options |
50 | - LOCAL_REQUIRED_MODULES := asan.options | |
117 | + LOCAL_REQUIRED_MODULES := asan.options $(ASAN_OPTIONS_FILES) | |
51 | 118 | endif |
52 | 119 | # Put it here instead of in init.rc module definition, |
53 | 120 | # because init.rc is conditionally included. |
@@ -3,3 +3,4 @@ detect_odr_violation=0 | ||
3 | 3 | alloc_dealloc_mismatch=0 |
4 | 4 | allocator_may_return_null=1 |
5 | 5 | detect_container_overflow=0 |
6 | +include_if_exists=/system/asan.options.%b |
@@ -0,0 +1,7 @@ | ||
1 | +quarantine_size_mb=0 | |
2 | +max_redzone=16 | |
3 | +poison_heap=false | |
4 | +poison_partial=false | |
5 | +poison_array_cookie=false | |
6 | +alloc_dealloc_mismatch=false | |
7 | +new_delete_type_mismatch=false |