Pārlūkot izejas kodu

Stripped sanitizer

Efren Yevale Varela 2 nedēļas atpakaļ
vecāks
revīzija
f936ccdf85
2 mainītis faili ar 19 papildinājumiem un 3 dzēšanām
  1. 11 0
      .clusterfuzzlite/build.sh
  2. 8 3
      docs/CONTRIBUTING.md

+ 11 - 0
.clusterfuzzlite/build.sh

@@ -16,6 +16,17 @@ cd "$SRC/d-oauth-server/fuzz"
 CXXFLAGS="${CXXFLAGS:-}"
 export CXXFLAGS="${CXXFLAGS//-stdlib=libc++/}"
 
+# ClusterFuzzLite exports sanitizer RUSTFLAGS globally (-Cpasses=sancov-module,
+# -Zsanitizer=address, ...). Cargo applies RUSTFLAGS to every unit including
+# host proc-macro dylibs; an instrumented proc-macro (e.g. sqlx-macros) then
+# fails at dlopen with `undefined symbol: __sancov_lowest_stack`, because the
+# sancov runtime links only into the final fuzz executable. Host and target
+# share the same triple here, so per-target rustflags would match proc-macros
+# too. Drop the inherited flags and let `cargo fuzz` re-apply its own scoped
+# sanitizer/coverage flags (the same mechanism `ci.yml fuzz-build` relies on,
+# which runs with no sanitizer env).
+unset RUSTFLAGS
+
 cargo fuzz build -O --debug-assertions
 
 for target_path in fuzz_targets/*.rs; do

+ 8 - 3
docs/CONTRIBUTING.md

@@ -150,9 +150,14 @@ The containerized (ClusterFuzzLite/OSS-Fuzz) build runs inside the Rust base
 image, which exports `CXX=clang++` with a `CXXFLAGS` selecting libc++. That
 breaks the link: libfuzzer-sys compiles libFuzzer's C++ runtime with `$CXX`,
 but rustc/`cc` links the C++ stdlib as `-lstdc++`, so the runtime's libc++
-(`std::__1::`) symbols go undefined. `.clusterfuzzlite/build.sh` drops
-`-stdlib=libc++` before building (clang++ then defaults to libstdc++), and the
-image pins `cargo-fuzz` so the tool cannot drift.
+ (`std::__1::`) symbols go undefined. `.clusterfuzzlite/build.sh` drops
+`-stdlib=libc++` before building (clang++ then defaults to libstdc++). It also
+drops the ClusterFuzzLite-injected sanitizer `RUSTFLAGS`: applied globally,
+they instrument host proc-macro dylibs (e.g. `sqlx-macros`), which then fail
+at `dlopen` with `undefined symbol: __sancov_lowest_stack`. `cargo fuzz`
+re-applies its own scoped flags instead (same as the `ci.yml fuzz-build` leg).
+Per-target `rustflags` cannot fix this — host and target share one triple —
+and the image pins `cargo-fuzz` so the tool cannot drift.
 
 Corpora persist across runs: `cargo fuzz run` reads and writes
 `fuzz/corpus/<target>/` (gitignored, but cached across CI runs by the