Loading rust/fuzz_test.go +4 −6 Original line number Diff line number Diff line Loading @@ -46,18 +46,16 @@ func TestRustFuzz(t *testing.T) { // Check that compiler flags are set appropriately . fuzz_libtest := ctx.ModuleForTests("fuzz_libtest", "android_arm64_armv8-a_fuzzer").Rule("rustc") if !strings.Contains(fuzz_libtest.Args["rustcFlags"], "-Z sanitizer=hwaddress") || !strings.Contains(fuzz_libtest.Args["rustcFlags"], "-C passes='sancov-module'") || if !strings.Contains(fuzz_libtest.Args["rustcFlags"], "-C passes='sancov-module'") || !strings.Contains(fuzz_libtest.Args["rustcFlags"], "--cfg fuzzing") { t.Errorf("rust_fuzz module does not contain the expected flags (sancov-module, cfg fuzzing, hwaddress sanitizer).") t.Errorf("rust_fuzz module does not contain the expected flags (sancov-module, cfg fuzzing).") } // Check that dependencies have 'fuzzer' variants produced for them as well. libtest_fuzzer := ctx.ModuleForTests("libtest_fuzzing", "android_arm64_armv8-a_rlib_rlib-std_fuzzer").Output("libtest_fuzzing.rlib") if !strings.Contains(libtest_fuzzer.Args["rustcFlags"], "-Z sanitizer=hwaddress") || !strings.Contains(libtest_fuzzer.Args["rustcFlags"], "-C passes='sancov-module'") || if !strings.Contains(libtest_fuzzer.Args["rustcFlags"], "-C passes='sancov-module'") || !strings.Contains(libtest_fuzzer.Args["rustcFlags"], "--cfg fuzzing") { t.Errorf("rust_fuzz dependent library does not contain the expected flags (sancov-module, cfg fuzzing, hwaddress sanitizer).") t.Errorf("rust_fuzz dependent library does not contain the expected flags (sancov-module, cfg fuzzing).") } } rust/sanitize.go +0 −13 Original line number Diff line number Diff line Loading @@ -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) { Loading Loading @@ -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) } Loading Loading
rust/fuzz_test.go +4 −6 Original line number Diff line number Diff line Loading @@ -46,18 +46,16 @@ func TestRustFuzz(t *testing.T) { // Check that compiler flags are set appropriately . fuzz_libtest := ctx.ModuleForTests("fuzz_libtest", "android_arm64_armv8-a_fuzzer").Rule("rustc") if !strings.Contains(fuzz_libtest.Args["rustcFlags"], "-Z sanitizer=hwaddress") || !strings.Contains(fuzz_libtest.Args["rustcFlags"], "-C passes='sancov-module'") || if !strings.Contains(fuzz_libtest.Args["rustcFlags"], "-C passes='sancov-module'") || !strings.Contains(fuzz_libtest.Args["rustcFlags"], "--cfg fuzzing") { t.Errorf("rust_fuzz module does not contain the expected flags (sancov-module, cfg fuzzing, hwaddress sanitizer).") t.Errorf("rust_fuzz module does not contain the expected flags (sancov-module, cfg fuzzing).") } // Check that dependencies have 'fuzzer' variants produced for them as well. libtest_fuzzer := ctx.ModuleForTests("libtest_fuzzing", "android_arm64_armv8-a_rlib_rlib-std_fuzzer").Output("libtest_fuzzing.rlib") if !strings.Contains(libtest_fuzzer.Args["rustcFlags"], "-Z sanitizer=hwaddress") || !strings.Contains(libtest_fuzzer.Args["rustcFlags"], "-C passes='sancov-module'") || if !strings.Contains(libtest_fuzzer.Args["rustcFlags"], "-C passes='sancov-module'") || !strings.Contains(libtest_fuzzer.Args["rustcFlags"], "--cfg fuzzing") { t.Errorf("rust_fuzz dependent library does not contain the expected flags (sancov-module, cfg fuzzing, hwaddress sanitizer).") t.Errorf("rust_fuzz dependent library does not contain the expected flags (sancov-module, cfg fuzzing).") } }
rust/sanitize.go +0 −13 Original line number Diff line number Diff line Loading @@ -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) { Loading Loading @@ -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) } Loading