Revert "rust: Add SCS sanitizer option."
This reverts commit 447f5b1ea9
.
Reason for revert: b/293445283
Change-Id: Iadc6c7ed196be2a65329f86423730ba7f851002c
This commit is contained in:
committed by
Gerrit Code Review
parent
447f5b1ea9
commit
f9780422b3
@@ -100,7 +100,7 @@ const (
|
|||||||
Hwasan
|
Hwasan
|
||||||
tsan
|
tsan
|
||||||
intOverflow
|
intOverflow
|
||||||
Scs
|
scs
|
||||||
Fuzzer
|
Fuzzer
|
||||||
Memtag_heap
|
Memtag_heap
|
||||||
Memtag_stack
|
Memtag_stack
|
||||||
@@ -113,7 +113,7 @@ var Sanitizers = []SanitizerType{
|
|||||||
Hwasan,
|
Hwasan,
|
||||||
tsan,
|
tsan,
|
||||||
intOverflow,
|
intOverflow,
|
||||||
Scs,
|
scs,
|
||||||
Fuzzer,
|
Fuzzer,
|
||||||
Memtag_heap,
|
Memtag_heap,
|
||||||
Memtag_stack,
|
Memtag_stack,
|
||||||
@@ -134,7 +134,7 @@ func (t SanitizerType) variationName() string {
|
|||||||
return "intOverflow"
|
return "intOverflow"
|
||||||
case cfi:
|
case cfi:
|
||||||
return "cfi"
|
return "cfi"
|
||||||
case Scs:
|
case scs:
|
||||||
return "scs"
|
return "scs"
|
||||||
case Memtag_heap:
|
case Memtag_heap:
|
||||||
return "memtag_heap"
|
return "memtag_heap"
|
||||||
@@ -168,7 +168,7 @@ func (t SanitizerType) name() string {
|
|||||||
return "integer_overflow"
|
return "integer_overflow"
|
||||||
case cfi:
|
case cfi:
|
||||||
return "cfi"
|
return "cfi"
|
||||||
case Scs:
|
case scs:
|
||||||
return "shadow-call-stack"
|
return "shadow-call-stack"
|
||||||
case Fuzzer:
|
case Fuzzer:
|
||||||
return "fuzzer"
|
return "fuzzer"
|
||||||
@@ -179,7 +179,7 @@ func (t SanitizerType) name() string {
|
|||||||
|
|
||||||
func (t SanitizerType) registerMutators(ctx android.RegisterMutatorsContext) {
|
func (t SanitizerType) registerMutators(ctx android.RegisterMutatorsContext) {
|
||||||
switch t {
|
switch t {
|
||||||
case cfi, Hwasan, Asan, tsan, Fuzzer, Scs:
|
case cfi, Hwasan, Asan, tsan, Fuzzer, scs:
|
||||||
sanitizer := &sanitizerSplitMutator{t}
|
sanitizer := &sanitizerSplitMutator{t}
|
||||||
ctx.TopDown(t.variationName()+"_markapexes", sanitizer.markSanitizableApexesMutator)
|
ctx.TopDown(t.variationName()+"_markapexes", sanitizer.markSanitizableApexesMutator)
|
||||||
ctx.Transition(t.variationName(), sanitizer)
|
ctx.Transition(t.variationName(), sanitizer)
|
||||||
@@ -216,7 +216,7 @@ func (*Module) SanitizerSupported(t SanitizerType) bool {
|
|||||||
return true
|
return true
|
||||||
case cfi:
|
case cfi:
|
||||||
return true
|
return true
|
||||||
case Scs:
|
case scs:
|
||||||
return true
|
return true
|
||||||
case Fuzzer:
|
case Fuzzer:
|
||||||
return true
|
return true
|
||||||
@@ -1022,7 +1022,7 @@ func (s *sanitize) getSanitizerBoolPtr(t SanitizerType) *bool {
|
|||||||
return s.Properties.SanitizeMutated.Integer_overflow
|
return s.Properties.SanitizeMutated.Integer_overflow
|
||||||
case cfi:
|
case cfi:
|
||||||
return s.Properties.SanitizeMutated.Cfi
|
return s.Properties.SanitizeMutated.Cfi
|
||||||
case Scs:
|
case scs:
|
||||||
return s.Properties.SanitizeMutated.Scs
|
return s.Properties.SanitizeMutated.Scs
|
||||||
case Memtag_heap:
|
case Memtag_heap:
|
||||||
return s.Properties.SanitizeMutated.Memtag_heap
|
return s.Properties.SanitizeMutated.Memtag_heap
|
||||||
@@ -1043,7 +1043,7 @@ func (sanitize *sanitize) isUnsanitizedVariant() bool {
|
|||||||
!sanitize.isSanitizerEnabled(Hwasan) &&
|
!sanitize.isSanitizerEnabled(Hwasan) &&
|
||||||
!sanitize.isSanitizerEnabled(tsan) &&
|
!sanitize.isSanitizerEnabled(tsan) &&
|
||||||
!sanitize.isSanitizerEnabled(cfi) &&
|
!sanitize.isSanitizerEnabled(cfi) &&
|
||||||
!sanitize.isSanitizerEnabled(Scs) &&
|
!sanitize.isSanitizerEnabled(scs) &&
|
||||||
!sanitize.isSanitizerEnabled(Memtag_heap) &&
|
!sanitize.isSanitizerEnabled(Memtag_heap) &&
|
||||||
!sanitize.isSanitizerEnabled(Memtag_stack) &&
|
!sanitize.isSanitizerEnabled(Memtag_stack) &&
|
||||||
!sanitize.isSanitizerEnabled(Memtag_globals) &&
|
!sanitize.isSanitizerEnabled(Memtag_globals) &&
|
||||||
@@ -1080,7 +1080,7 @@ func (sanitize *sanitize) SetSanitizer(t SanitizerType, b bool) {
|
|||||||
sanitize.Properties.SanitizeMutated.Integer_overflow = bPtr
|
sanitize.Properties.SanitizeMutated.Integer_overflow = bPtr
|
||||||
case cfi:
|
case cfi:
|
||||||
sanitize.Properties.SanitizeMutated.Cfi = bPtr
|
sanitize.Properties.SanitizeMutated.Cfi = bPtr
|
||||||
case Scs:
|
case scs:
|
||||||
sanitize.Properties.SanitizeMutated.Scs = bPtr
|
sanitize.Properties.SanitizeMutated.Scs = bPtr
|
||||||
case Memtag_heap:
|
case Memtag_heap:
|
||||||
sanitize.Properties.SanitizeMutated.Memtag_heap = bPtr
|
sanitize.Properties.SanitizeMutated.Memtag_heap = bPtr
|
||||||
@@ -1340,7 +1340,7 @@ func (s *sanitizerSplitMutator) Mutate(mctx android.BottomUpMutatorContext, vari
|
|||||||
|
|
||||||
oneMakeVariation := false
|
oneMakeVariation := false
|
||||||
if c.StaticallyLinked() || c.Header() {
|
if c.StaticallyLinked() || c.Header() {
|
||||||
if s.sanitizer != cfi && s.sanitizer != Scs && s.sanitizer != Hwasan {
|
if s.sanitizer != cfi && s.sanitizer != scs && s.sanitizer != Hwasan {
|
||||||
// These sanitizers export only one variation to Make. For the rest,
|
// These sanitizers export only one variation to Make. For the rest,
|
||||||
// Make targets can depend on both the sanitized and non-sanitized
|
// Make targets can depend on both the sanitized and non-sanitized
|
||||||
// versions.
|
// versions.
|
||||||
@@ -1350,7 +1350,7 @@ func (s *sanitizerSplitMutator) Mutate(mctx android.BottomUpMutatorContext, vari
|
|||||||
// Shared library. These are the sanitizers that do propagate through shared
|
// Shared library. These are the sanitizers that do propagate through shared
|
||||||
// library dependencies and therefore can cause multiple variations of a
|
// library dependencies and therefore can cause multiple variations of a
|
||||||
// shared library to be built.
|
// shared library to be built.
|
||||||
if s.sanitizer != cfi && s.sanitizer != Hwasan && s.sanitizer != Scs && s.sanitizer != Asan {
|
if s.sanitizer != cfi && s.sanitizer != Hwasan && s.sanitizer != scs && s.sanitizer != Asan {
|
||||||
oneMakeVariation = true
|
oneMakeVariation = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -95,7 +95,7 @@ func isSnapshotAware(cfg android.DeviceConfig, m LinkableInterface, inProprietar
|
|||||||
if sanitizable.SanitizePropDefined() {
|
if sanitizable.SanitizePropDefined() {
|
||||||
// scs exports both sanitized and unsanitized variants for static and header
|
// scs exports both sanitized and unsanitized variants for static and header
|
||||||
// Always use unsanitized variant of it.
|
// Always use unsanitized variant of it.
|
||||||
if !sanitizable.Shared() && sanitizable.IsSanitizerEnabled(Scs) {
|
if !sanitizable.Shared() && sanitizable.IsSanitizerEnabled(scs) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
// cfi and hwasan also export both variants. But for static, we capture both.
|
// cfi and hwasan also export both variants. But for static, we capture both.
|
||||||
|
@@ -32,7 +32,6 @@ type SanitizeProperties struct {
|
|||||||
Sanitize struct {
|
Sanitize struct {
|
||||||
Address *bool `android:"arch_variant"`
|
Address *bool `android:"arch_variant"`
|
||||||
Hwaddress *bool `android:"arch_variant"`
|
Hwaddress *bool `android:"arch_variant"`
|
||||||
Scs *bool `android:"arch_variant"`
|
|
||||||
|
|
||||||
// Memory-tagging, only available on arm64
|
// Memory-tagging, only available on arm64
|
||||||
// if diag.memtag unset or false, enables async memory tagging
|
// if diag.memtag unset or false, enables async memory tagging
|
||||||
@@ -76,9 +75,6 @@ var fuzzerFlags = []string{
|
|||||||
var asanFlags = []string{
|
var asanFlags = []string{
|
||||||
"-Z sanitizer=address",
|
"-Z sanitizer=address",
|
||||||
}
|
}
|
||||||
var scsFlags = []string{
|
|
||||||
"-Z sanitizer=shadow-call-stack",
|
|
||||||
}
|
|
||||||
|
|
||||||
// See cc/sanitize.go's hwasanGlobalOptions for global hwasan options.
|
// See cc/sanitize.go's hwasanGlobalOptions for global hwasan options.
|
||||||
var hwasanFlags = []string{
|
var hwasanFlags = []string{
|
||||||
@@ -212,14 +208,9 @@ func (sanitize *sanitize) begin(ctx BaseModuleContext) {
|
|||||||
s.Memtag_heap = nil
|
s.Memtag_heap = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SCS is only implemented on AArch64/riscv64.
|
|
||||||
if (ctx.Arch().ArchType != android.Arm64 && ctx.Arch().ArchType != android.Riscv64) || !ctx.toolchain().Bionic() {
|
|
||||||
s.Scs = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO:(b/178369775)
|
// TODO:(b/178369775)
|
||||||
// For now sanitizing is only supported on devices
|
// For now sanitizing is only supported on devices
|
||||||
if ctx.Os() == android.Android && (Bool(s.Hwaddress) || Bool(s.Address) || Bool(s.Memtag_heap) || Bool(s.Fuzzer) || Bool(s.Scs)) {
|
if ctx.Os() == android.Android && (Bool(s.Hwaddress) || Bool(s.Address) || Bool(s.Memtag_heap) || Bool(s.Fuzzer)) {
|
||||||
sanitize.Properties.SanitizerEnabled = true
|
sanitize.Properties.SanitizerEnabled = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -238,10 +229,7 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags, deps PathDeps) (
|
|||||||
flags.RustFlags = append(flags.RustFlags, hwasanFlags...)
|
flags.RustFlags = append(flags.RustFlags, hwasanFlags...)
|
||||||
} else if Bool(sanitize.Properties.Sanitize.Address) {
|
} else if Bool(sanitize.Properties.Sanitize.Address) {
|
||||||
flags.RustFlags = append(flags.RustFlags, asanFlags...)
|
flags.RustFlags = append(flags.RustFlags, asanFlags...)
|
||||||
} else if Bool(sanitize.Properties.Sanitize.Scs) {
|
|
||||||
flags.RustFlags = append(flags.RustFlags, scsFlags...)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return flags, deps
|
return flags, deps
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,9 +311,6 @@ func (sanitize *sanitize) SetSanitizer(t cc.SanitizerType, b bool) {
|
|||||||
case cc.Memtag_heap:
|
case cc.Memtag_heap:
|
||||||
sanitize.Properties.Sanitize.Memtag_heap = boolPtr(b)
|
sanitize.Properties.Sanitize.Memtag_heap = boolPtr(b)
|
||||||
sanitizerSet = true
|
sanitizerSet = true
|
||||||
case cc.Scs:
|
|
||||||
sanitize.Properties.Sanitize.Scs = boolPtr(b)
|
|
||||||
sanitizerSet = true
|
|
||||||
default:
|
default:
|
||||||
panic(fmt.Errorf("setting unsupported sanitizerType %d", t))
|
panic(fmt.Errorf("setting unsupported sanitizerType %d", t))
|
||||||
}
|
}
|
||||||
@@ -387,8 +372,6 @@ func (sanitize *sanitize) getSanitizerBoolPtr(t cc.SanitizerType) *bool {
|
|||||||
return sanitize.Properties.Sanitize.Hwaddress
|
return sanitize.Properties.Sanitize.Hwaddress
|
||||||
case cc.Memtag_heap:
|
case cc.Memtag_heap:
|
||||||
return sanitize.Properties.Sanitize.Memtag_heap
|
return sanitize.Properties.Sanitize.Memtag_heap
|
||||||
case cc.Scs:
|
|
||||||
return sanitize.Properties.Sanitize.Scs
|
|
||||||
default:
|
default:
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -401,10 +384,6 @@ func (sanitize *sanitize) AndroidMk(ctx AndroidMkContext, entries *android.Andro
|
|||||||
if sanitize.isSanitizerEnabled(cc.Hwasan) {
|
if sanitize.isSanitizerEnabled(cc.Hwasan) {
|
||||||
entries.SubName += ".hwasan"
|
entries.SubName += ".hwasan"
|
||||||
}
|
}
|
||||||
if sanitize.isSanitizerEnabled(cc.Scs) {
|
|
||||||
entries.SubName += ".scs"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -425,8 +404,6 @@ func (mod *Module) SanitizerSupported(t cc.SanitizerType) bool {
|
|||||||
return true
|
return true
|
||||||
case cc.Memtag_heap:
|
case cc.Memtag_heap:
|
||||||
return true
|
return true
|
||||||
case cc.Scs:
|
|
||||||
return true
|
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user