Remove prefer_sanitize.* properties
am: f97782b18c
Change-Id: I89cf55ff2cea384e1cf25c59f538dc185088a0cc
This commit is contained in:
42
apex/apex.go
42
apex/apex.go
@@ -257,18 +257,8 @@ type apexBundleProperties struct {
|
|||||||
|
|
||||||
Multilib apexMultilibProperties
|
Multilib apexMultilibProperties
|
||||||
|
|
||||||
Prefer_sanitize struct {
|
// List of sanitizer names that this APEX is enabled for
|
||||||
// Prefer native libraries with asan if available
|
SanitizerNames []string `blueprint:"mutated"`
|
||||||
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 {
|
type apexTargetBundleProperties struct {
|
||||||
@@ -551,30 +541,16 @@ func (a *apexBundle) getImageVariation(config android.DeviceConfig) string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *apexBundle) EnableSanitizer(sanitizerName string) {
|
||||||
|
if !android.InList(sanitizerName, a.properties.SanitizerNames) {
|
||||||
|
a.properties.SanitizerNames = append(a.properties.SanitizerNames, sanitizerName)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (a *apexBundle) IsSanitizerEnabled(ctx android.BaseModuleContext, sanitizerName string) bool {
|
func (a *apexBundle) IsSanitizerEnabled(ctx android.BaseModuleContext, sanitizerName string) bool {
|
||||||
// If this APEX is configured to prefer a sanitizer, use it
|
if android.InList(sanitizerName, a.properties.SanitizerNames) {
|
||||||
switch sanitizerName {
|
|
||||||
case "asan":
|
|
||||||
if proptools.Bool(a.properties.Prefer_sanitize.Address) {
|
|
||||||
return true
|
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
|
// Then follow the global setting
|
||||||
globalSanitizerNames := []string{}
|
globalSanitizerNames := []string{}
|
||||||
|
@@ -666,6 +666,14 @@ func sanitizerDepsMutator(t sanitizerType) func(android.TopDownMutatorContext) {
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
} else if sanitizeable, ok := mctx.Module().(Sanitizeable); ok {
|
||||||
|
// If an APEX module includes a lib which is enabled for a sanitizer T, then
|
||||||
|
// the APEX module is also enabled for the same sanitizer type.
|
||||||
|
mctx.VisitDirectDeps(func(child android.Module) {
|
||||||
|
if c, ok := child.(*Module); ok && c.sanitize.isSanitizerEnabled(t) {
|
||||||
|
sanitizeable.EnableSanitizer(t.name())
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -848,6 +856,7 @@ func sanitizerRuntimeMutator(mctx android.BottomUpMutatorContext) {
|
|||||||
type Sanitizeable interface {
|
type Sanitizeable interface {
|
||||||
android.Module
|
android.Module
|
||||||
IsSanitizerEnabled(ctx android.BaseModuleContext, sanitizerName string) bool
|
IsSanitizerEnabled(ctx android.BaseModuleContext, sanitizerName string) bool
|
||||||
|
EnableSanitizer(sanitizerName string)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create sanitized variants for modules that need them
|
// Create sanitized variants for modules that need them
|
||||||
|
Reference in New Issue
Block a user