rust: Skip global 'fuzzer' sanitizer static bins
The 'fuzzer' sanitizer enables 'hwasan', which is not supported for Rust
static binaries. Make sure we skip applying this sanitizer to those
binaries.
Bug: 204776996
Test: SANITIZE_TARGET=fuzzer m <static_rust_executable>
Change-Id: I619cfab32b46c0811590973344eb5cdbe3f1a119
diff --git a/rust/sanitize.go b/rust/sanitize.go
index fdb342d..d9446e5 100644
--- a/rust/sanitize.go
+++ b/rust/sanitize.go
@@ -144,7 +144,7 @@
// Global Sanitizers
if found, globalSanitizers = android.RemoveFromList("hwaddress", globalSanitizers); found && s.Hwaddress == nil {
- // TODO(b/180495975): HWASan for static Rust binaries isn't supported yet.
+ // TODO(b/204776996): HWASan for static Rust binaries isn't supported yet.
if !ctx.RustModule().StaticExecutable() {
s.Hwaddress = proptools.BoolPtr(true)
}
@@ -161,7 +161,10 @@
}
if found, globalSanitizers = android.RemoveFromList("fuzzer", globalSanitizers); found && s.Fuzzer == nil {
- s.Fuzzer = proptools.BoolPtr(true)
+ // TODO(b/204776996): HWASan for static Rust binaries isn't supported yet, and fuzzer enables HWAsan
+ if !ctx.RustModule().StaticExecutable() {
+ s.Fuzzer = proptools.BoolPtr(true)
+ }
}
// Global Diag Sanitizers
@@ -289,7 +292,7 @@
deps = []string{config.LibclangRuntimeLibrary(mod.toolchain(mctx), "asan")}
} else if mod.IsSanitizerEnabled(cc.Hwasan) ||
(mod.IsSanitizerEnabled(cc.Fuzzer) && mctx.Arch().ArchType == android.Arm64) {
- // TODO(b/180495975): HWASan for static Rust binaries isn't supported yet.
+ // TODO(b/204776996): HWASan for static Rust binaries isn't supported yet.
if binary, ok := mod.compiler.(binaryInterface); ok {
if binary.staticallyLinked() {
mctx.ModuleErrorf("HWASan is not supported for static Rust executables yet.")