rust: Support sanitizers in rust_ffi modules

Don't automatically assume that HWASAN or ASAN is enabled if Fuzzer is
enabled.

Bug: 178365482
Test: m bluetooth_stack_with_facade
Test: SANITIZE_TARGET=fuzzer m bluetooth_stack_with_facade
Test: SANITIZE_TARGET=address m bluetooth_stack_with_facade
Test: SANITIZE_TARGET=hwaddress m bluetooth_stack_with_facade
Test: SANITIZE_TARGET="fuzzer address" m bluetooth_stack_with_facade
Test: SANITIZE_TARGET="fuzzer hwaddress" m bluetooth_stack_with_facade
Change-Id: Ief8c0f899837c5889a8035782616025f1b0d54e7
This commit is contained in:
Ivan Lozano
2023-05-24 15:53:43 +00:00
parent cd4e6a609e
commit 7f9d7cbb75
2 changed files with 4 additions and 19 deletions

View File

@@ -226,11 +226,6 @@ func (sanitize *sanitize) flags(ctx ModuleContext, flags Flags, deps PathDeps) (
}
if Bool(sanitize.Properties.Sanitize.Fuzzer) {
flags.RustFlags = append(flags.RustFlags, fuzzerFlags...)
if ctx.Arch().ArchType == android.Arm64 && ctx.Os().Bionic() {
flags.RustFlags = append(flags.RustFlags, hwasanFlags...)
} else {
flags.RustFlags = append(flags.RustFlags, asanFlags...)
}
} else if Bool(sanitize.Properties.Sanitize.Hwaddress) {
flags.RustFlags = append(flags.RustFlags, hwasanFlags...)
} else if Bool(sanitize.Properties.Sanitize.Address) {
@@ -424,14 +419,6 @@ func (mod *Module) IsSanitizerExplicitlyDisabled(t cc.SanitizerType) bool {
return true
}
// TODO(b/178365482): Rust/CC interop doesn't work just yet; don't sanitize rust_ffi modules until
// linkage issues are resolved.
if lib, ok := mod.compiler.(libraryInterface); ok {
if lib.shared() || lib.static() {
return true
}
}
return mod.sanitize.isSanitizerExplicitlyDisabled(t)
}