diff --git a/infra/base-images/base-builder-rust/Dockerfile b/infra/base-images/base-builder-rust/Dockerfile index a4ec327b6702..e828953fcdf5 100644 --- a/infra/base-images/base-builder-rust/Dockerfile +++ b/infra/base-images/base-builder-rust/Dockerfile @@ -22,4 +22,15 @@ ENV PATH=$PATH:/rust/bin # Set up custom environment variable for source code copy for coverage reports ENV OSSFUZZ_RUSTPATH /rust +# Force rustup to ignore `rust-toolchain` and `rust-toolchain.toml` files by +# manually specifying what toolchain to use. Note that this environment variable +# is additionally used by `install_rust.sh` as the toolchain to install. +# cf https://rust-lang.github.io/rustup/overrides.html +ENV RUSTUP_TOOLCHAIN nightly-2024-06-17 + +# Configure the linker used by default for x86_64 linux to be `clang` instead of +# rustc's default of `cc` which is able to find custom-built libraries like +# `libc++` by default more easily. +ENV CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER clang + RUN install_rust.sh diff --git a/infra/base-images/base-builder/install_rust.sh b/infra/base-images/base-builder/install_rust.sh index 745babdb31e1..eb8806f1b40e 100755 --- a/infra/base-images/base-builder/install_rust.sh +++ b/infra/base-images/base-builder/install_rust.sh @@ -15,8 +15,8 @@ # ################################################################################ -curl https://sh.rustup.rs | sh -s -- -y --default-toolchain=nightly-2024-06-17 --profile=minimal +curl https://sh.rustup.rs | sh -s -- -y --default-toolchain=$RUSTUP_TOOLCHAIN --profile=minimal cargo install cargo-fuzz && rm -rf /rust/registry # Needed to recompile rust std library for MSAN -rustup component add rust-src --toolchain nightly-2024-06-17 +rustup component add rust-src cp -r /usr/local/lib/x86_64-unknown-linux-gnu/* /usr/local/lib/ diff --git a/projects/askama/build.sh b/projects/askama/build.sh index dc9b7030ff28..39ddbc1c39ab 100755 --- a/projects/askama/build.sh +++ b/projects/askama/build.sh @@ -23,7 +23,7 @@ for CRATE_DIR in ${FUZZ_CRATE_DIRS[@]}; do echo "Building crate: $CRATE_DIR" cd $CRATE_DIR - cargo +nightly-2023-12-28 fuzz build -O + cargo fuzz build -O FUZZ_TARGET_OUTPUT_DIR=fuzz/target/x86_64-unknown-linux-gnu/release for f in fuzz/fuzz_targets/*.rs do diff --git a/projects/crosvm/build.sh b/projects/crosvm/build.sh index cdda20e505c8..869abc36dedf 100755 --- a/projects/crosvm/build.sh +++ b/projects/crosvm/build.sh @@ -19,7 +19,7 @@ cd crosvm # Build crosvm fuzzers # Unset the SRC variable as it will interfere with minijail's common.mk framework. -env -u SRC cargo +nightly-2023-12-28 fuzz build -O +env -u SRC cargo fuzz build -O # Copy fuzzer binaries to $OUT FUZZ_TARGET_OUTPUT_DIR="target/x86_64-unknown-linux-gnu/release" diff --git a/projects/gitoxide/build.sh b/projects/gitoxide/build.sh index 8bd52d90230b..7ed2666e0874 100755 --- a/projects/gitoxide/build.sh +++ b/projects/gitoxide/build.sh @@ -25,19 +25,19 @@ for CRATE_DIR in ${FUZZ_CRATE_DIRS[@]}; do echo "Building crate: $CRATE_DIR" cd $CRATE_DIR - cargo +nightly-2023-12-28 fuzz build -O --debug-assertions + cargo fuzz build -O --debug-assertions FUZZ_TARGET_OUTPUT_DIR=$CARGO_BUILD_TARGET_DIR/x86_64-unknown-linux-gnu/release for f in fuzz/fuzz_targets/*.rs do FUZZ_TARGET_NAME=$(basename ${f%.*}) CRATE_NAME=$(basename $CRATE_DIR) OUT_FUZZER_NAME=$OUT/$CRATE_NAME-$FUZZ_TARGET_NAME - cp $FUZZ_TARGET_OUTPUT_DIR/$FUZZ_TARGET_NAME $OUT_FUZZER_NAME - FUZZ_CORPUS_BUILDER=./fuzz/fuzz_targets/${FUZZ_TARGET_NAME}_corpus_builder.sh + cp $FUZZ_TARGET_OUTPUT_DIR/$FUZZ_TARGET_NAME $OUT_FUZZER_NAME + FUZZ_CORPUS_BUILDER=./fuzz/fuzz_targets/${FUZZ_TARGET_NAME}_corpus_builder.sh if test -f "$FUZZ_CORPUS_BUILDER"; then $FUZZ_CORPUS_BUILDER $SRC/gitoxide ${OUT_FUZZER_NAME}_seed_corpus.zip fi - FUZZ_DICT=./fuzz/fuzz_targets/${FUZZ_TARGET_NAME}.dict + FUZZ_DICT=./fuzz/fuzz_targets/${FUZZ_TARGET_NAME}.dict if test -f "$FUZZ_DICT"; then cp $FUZZ_DICT ${OUT_FUZZER_NAME}.dict fi diff --git a/projects/linkerd2-proxy/build.sh b/projects/linkerd2-proxy/build.sh index 3a1a4cc457f2..f592c56067e7 100755 --- a/projects/linkerd2-proxy/build.sh +++ b/projects/linkerd2-proxy/build.sh @@ -23,7 +23,7 @@ then export CFLAGS="" fi -BUILD_FUZZER="cargo +nightly-2023-12-28 fuzz build " +BUILD_FUZZER="cargo fuzz build " TARGET_PATH="./fuzz/target/x86_64-unknown-linux-gnu/release" BASE="$SRC/linkerd2-proxy/linkerd" diff --git a/projects/naga/build.sh b/projects/naga/build.sh index b7d68cacf9e2..b8e7c0224d8a 100755 --- a/projects/naga/build.sh +++ b/projects/naga/build.sh @@ -15,7 +15,7 @@ # ################################################################################ -cargo +nightly-2023-12-28 fuzz build -O +cargo fuzz build -O fuzz_release=$SRC/wgpu/target/x86_64-unknown-linux-gnu/release cp $fuzz_release/spv_parser $OUT/ cp $fuzz_release/wgsl_parser $OUT/ diff --git a/projects/opendal/build.sh b/projects/opendal/build.sh index b915530efd1e..351f25aa70bb 100644 --- a/projects/opendal/build.sh +++ b/projects/opendal/build.sh @@ -15,7 +15,7 @@ # build fuzz targets cd $SRC/opendal/core -cargo +nightly-2023-12-28 fuzz build -O --debug-assertions +cargo fuzz build -O --debug-assertions # copy fuzz targets to $OUT targets=( diff --git a/projects/opensk/build.sh b/projects/opensk/build.sh index 8ee826f2964d..66e51fdd2193 100755 --- a/projects/opensk/build.sh +++ b/projects/opensk/build.sh @@ -17,10 +17,6 @@ FUZZ_TARGET_OUTPUT_DIR=fuzz/target/x86_64-unknown-linux-gnu/release -# do not use override toolchain -# cf https://rust-lang.github.io/rustup/overrides.html -export RUSTUP_TOOLCHAIN=nightly-2023-12-28 - build_and_copy() { pushd "$1" cargo fuzz build --release --debug-assertions