Add option to disable Scudo globally [Soong]

This adds an option in Soong to turn off Scudo globally.

Bug: 123228023
Test: enable Scudo for tombstoned, lunch marlin_svelte-eng && m -j, and
make sure that Scudo is not linked in
out/target/product/marlin/system/bin/tombstoned
Test: enable Scudo for tombstoned, lunch marlin-userdebug && m -j, and
make sure that Scudo is linked in
out/target/product/marlin/system/bin/tombstoned

Change-Id: I0b0992446953fc4074bde94507b66f92764c8143
Merged-In: I0b0992446953fc4074bde94507b66f92764c8143
This commit is contained in:
Kostya Kortchinsky
2019-02-01 08:42:56 -08:00
parent 54956abf1f
commit d5275c8657
3 changed files with 8 additions and 2 deletions

View File

@@ -665,6 +665,10 @@ func (c *config) EnableCFI() bool {
} }
} }
func (c *config) DisableScudo() bool {
return Bool(c.productVariables.DisableScudo)
}
func (c *config) EnableXOM() bool { func (c *config) EnableXOM() bool {
if c.productVariables.EnableXOM == nil { if c.productVariables.EnableXOM == nil {
return true return true

View File

@@ -213,6 +213,8 @@ type productVariables struct {
CFIExcludePaths []string `json:",omitempty"` CFIExcludePaths []string `json:",omitempty"`
CFIIncludePaths []string `json:",omitempty"` CFIIncludePaths []string `json:",omitempty"`
DisableScudo *bool `json:",omitempty"`
EnableXOM *bool `json:",omitempty"` EnableXOM *bool `json:",omitempty"`
XOMExcludePaths []string `json:",omitempty"` XOMExcludePaths []string `json:",omitempty"`

View File

@@ -370,8 +370,8 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
sanitize.Properties.SanitizerEnabled = true sanitize.Properties.SanitizerEnabled = true
} }
// Disable Scudo if ASan or TSan is enabled. // Disable Scudo if ASan or TSan is enabled, or if it's disabled globally.
if Bool(s.Address) || Bool(s.Thread) || Bool(s.Hwaddress) { if Bool(s.Address) || Bool(s.Thread) || Bool(s.Hwaddress) || ctx.Config().DisableScudo() {
s.Scudo = nil s.Scudo = nil
} }