Merge "soong: HWASan exclude path support" into main am: f3d52683a9 am: d24ed92a49 am: 3a5ed146cc am: fadd8932b2

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2721423

Change-Id: I3237fc305bf49fcfac56e02e9ef281dda532f975
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2023-09-06 03:15:26 +00:00
committed by Automerger Merge Worker
3 changed files with 12 additions and 2 deletions

View File

@@ -1662,11 +1662,18 @@ func (c *config) MemtagHeapSyncEnabledForPath(path string) bool {
return HasAnyPrefix(path, c.productVariables.MemtagHeapSyncIncludePaths) && !c.MemtagHeapDisabledForPath(path) return HasAnyPrefix(path, c.productVariables.MemtagHeapSyncIncludePaths) && !c.MemtagHeapDisabledForPath(path)
} }
func (c *config) HWASanDisabledForPath(path string) bool {
if len(c.productVariables.HWASanExcludePaths) == 0 {
return false
}
return HasAnyPrefix(path, c.productVariables.HWASanExcludePaths)
}
func (c *config) HWASanEnabledForPath(path string) bool { func (c *config) HWASanEnabledForPath(path string) bool {
if len(c.productVariables.HWASanIncludePaths) == 0 { if len(c.productVariables.HWASanIncludePaths) == 0 {
return false return false
} }
return HasAnyPrefix(path, c.productVariables.HWASanIncludePaths) return HasAnyPrefix(path, c.productVariables.HWASanIncludePaths) && !c.HWASanDisabledForPath(path)
} }
func (c *config) VendorConfig(name string) VendorConfig { func (c *config) VendorConfig(name string) VendorConfig {

View File

@@ -315,6 +315,7 @@ type ProductVariables struct {
MemtagHeapSyncIncludePaths []string `json:",omitempty"` MemtagHeapSyncIncludePaths []string `json:",omitempty"`
HWASanIncludePaths []string `json:",omitempty"` HWASanIncludePaths []string `json:",omitempty"`
HWASanExcludePaths []string `json:",omitempty"`
VendorPath *string `json:",omitempty"` VendorPath *string `json:",omitempty"`
OdmPath *string `json:",omitempty"` OdmPath *string `json:",omitempty"`

View File

@@ -553,7 +553,9 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
} }
if found, globalSanitizers = removeFromList("hwaddress", globalSanitizers); found && s.Hwaddress == nil { if found, globalSanitizers = removeFromList("hwaddress", globalSanitizers); found && s.Hwaddress == nil {
s.Hwaddress = proptools.BoolPtr(true) if !ctx.Config().HWASanDisabledForPath(ctx.ModuleDir()) {
s.Hwaddress = proptools.BoolPtr(true)
}
} }
if found, globalSanitizers = removeFromList("writeonly", globalSanitizers); found && s.Writeonly == nil { if found, globalSanitizers = removeFromList("writeonly", globalSanitizers); found && s.Writeonly == nil {