From b7d0f523374419b09c07cf95faa3a50b037572be Mon Sep 17 00:00:00 2001 From: Ivan Lozano Date: Sat, 20 Jan 2018 01:44:38 +0000 Subject: [PATCH] Revert "Support enabling overflow sanitization by path." This reverts commit 17df3c1b768496f26dc5021b3854c2dcb42f6207. Change-Id: Id5dab777da591c24113c3048b8606547a661afdd --- android/config.go | 7 ------- android/variable.go | 1 - cc/sanitize.go | 22 +--------------------- 3 files changed, 1 insertion(+), 29 deletions(-) diff --git a/android/config.go b/android/config.go index 5d38d7180..43d743b6b 100644 --- a/android/config.go +++ b/android/config.go @@ -712,13 +712,6 @@ func (c *config) CFIDisabledForPath(path string) bool { return PrefixInList(path, *c.ProductVariables.CFIExcludePaths) } -func (c *config) IntegerOverflowEnabledForPath(path string) bool { - if c.ProductVariables.IntegerOverflowIncludePaths == nil { - return false - } - return PrefixInList(path, *c.ProductVariables.IntegerOverflowIncludePaths) -} - func (c *config) CFIEnabledForPath(path string) bool { if c.ProductVariables.CFIIncludePaths == nil { return false diff --git a/android/variable.go b/android/variable.go index aa751a04f..d58ed6a9f 100644 --- a/android/variable.go +++ b/android/variable.go @@ -167,7 +167,6 @@ type productVariables struct { MinimizeJavaDebugInfo *bool `json:",omitempty"` IntegerOverflowExcludePaths *[]string `json:",omitempty"` - IntegerOverflowIncludePaths *[]string `json:",omitempty"` EnableCFI *bool `json:",omitempty"` CFIExcludePaths *[]string `json:",omitempty"` diff --git a/cc/sanitize.go b/cc/sanitize.go index 859478bb5..1afec2653 100644 --- a/cc/sanitize.go +++ b/cc/sanitize.go @@ -232,14 +232,6 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) { } } - // Enable Integer Overflow for all components in the include paths - if !ctx.Host() && ctx.Config().IntegerOverflowEnabledForPath(ctx.ModuleDir()) && s.Integer_overflow == nil { - s.Integer_overflow = boolPtr(true) - if inList("integer_overflow", ctx.Config().SanitizeDeviceDiag()) { - s.Diag.Integer_overflow = boolPtr(true) - } - } - // CFI needs gold linker, and mips toolchain does not have one. if !ctx.Config().EnableCFI() || ctx.Arch().ArchType == android.Mips || ctx.Arch().ArchType == android.Mips64 { s.Cfi = nil @@ -425,7 +417,6 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags { sanitizers = append(sanitizers, "unsigned-integer-overflow") sanitizers = append(sanitizers, "signed-integer-overflow") flags.CFlags = append(flags.CFlags, intOverflowCflags...) - if Bool(sanitize.Properties.Sanitize.Diag.Integer_overflow) { diagSanitizers = append(diagSanitizers, "unsigned-integer-overflow") diagSanitizers = append(diagSanitizers, "signed-integer-overflow") @@ -433,8 +424,6 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags { } } - diagSanitizeArgs := "-fno-sanitize-trap=" + strings.Join(diagSanitizers, ",") - if len(sanitizers) > 0 { sanitizeArg := "-fsanitize=" + strings.Join(sanitizers, ",") flags.CFlags = append(flags.CFlags, sanitizeArg) @@ -447,19 +436,10 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags) Flags { } else { flags.CFlags = append(flags.CFlags, "-fsanitize-trap=all", "-ftrap-function=abort") } - - // Specific settings for userdebug and eng builds - if Bool(ctx.Config().ProductVariables.Debuggable) { - // TODO(ivanlozano): uncomment after switch to clang-4536805. - // Run integer overflow sanitizers with the minimal runtime diagnostics. - if strings.Contains(sanitizeArg, "integer") && !strings.Contains(diagSanitizeArgs, "integer") && !Bool(sanitize.Properties.Sanitize.Address) { - //flags.CFlags = append(flags.CFlags, "-fsanitize-minimal-runtime") - } - } } if len(diagSanitizers) > 0 { - flags.CFlags = append(flags.CFlags, diagSanitizeArgs) + flags.CFlags = append(flags.CFlags, "-fno-sanitize-trap="+strings.Join(diagSanitizers, ",")) } // FIXME: enable RTTI if diag + (cfi or vptr)