diff options
author | Jiyong Park <jiyong@google.com> | 2019-02-09 11:50:56 +0900 |
---|---|---|
committer | Jiyong Park <jiyong@google.com> | 2019-02-09 12:07:08 +0900 |
commit | 235e67c281b0bb1024cb6850fb894d04ca3a75f0 (patch) | |
tree | f2abfd14400854b10ec0f3a98f26126e3909524b /apex | |
parent | 53d312637ff184ce76c72d06a491adc1e9d8702b (diff) | |
download | build_soong-235e67c281b0bb1024cb6850fb894d04ca3a75f0.tar.gz build_soong-235e67c281b0bb1024cb6850fb894d04ca3a75f0.tar.bz2 build_soong-235e67c281b0bb1024cb6850fb894d04ca3a75f0.zip |
Add prefer_sanitize.* properties to apex
It is used to configure an apex to prefere specific sanitizer variants
if available. For example, if a lib is with sanitize: {cfi: true} then
an APEX with prefer_sanitize: {cfi: true} will use the sanitized variant
of the lib.
Bug: 124128094
Test: m on marlin
extractor libraries are found under /system/apex/com.android.media
Change-Id: I858778eef78c5791cdeb497c7c11688cb128b5fe
Diffstat (limited to 'apex')
-rw-r--r-- | apex/apex.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/apex/apex.go b/apex/apex.go index 95cee0cd..0337afb8 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -252,6 +252,19 @@ type apexBundleProperties struct { Ignore_system_library_special_case *bool Multilib apexMultilibProperties + + Prefer_sanitize struct { + // Prefer native libraries with asan if available + Address *bool + // Prefer native libraries with hwasan if available + Hwaddress *bool + // Prefer native libraries with tsan if available + Thread *bool + // Prefer native libraries with integer_overflow if available + Integer_overflow *bool + // Prefer native libraries with cfi if available + Cfi *bool + } } type apexTargetBundleProperties struct { @@ -527,6 +540,31 @@ func (a *apexBundle) getImageVariation(config android.DeviceConfig) string { } func (a *apexBundle) IsSanitizerEnabled(ctx android.BaseModuleContext, sanitizerName string) bool { + // If this APEX is configured to prefer a sanitizer, use it + switch sanitizerName { + case "asan": + if proptools.Bool(a.properties.Prefer_sanitize.Address) { + return true + } + case "hwasan": + if proptools.Bool(a.properties.Prefer_sanitize.Hwaddress) { + return true + } + case "tsan": + if proptools.Bool(a.properties.Prefer_sanitize.Thread) { + return true + } + case "cfi": + if proptools.Bool(a.properties.Prefer_sanitize.Cfi) { + return true + } + case "integer_overflow": + if proptools.Bool(a.properties.Prefer_sanitize.Integer_overflow) { + return true + } + } + + // Then follow the global setting globalSanitizerNames := []string{} if a.Host() { globalSanitizerNames = ctx.Config().SanitizeHost() |