Skip to content

Commit

Permalink
Update projects to the latest Rust
Browse files Browse the repository at this point in the history
Go through projects explicitly mentioning `2023-12-28` and update them
to the latest nightly. Additionally move the specification of
`RUSTUP_TOOLCHAIN` into the base Rust image itself to force all projects
to ignore their `rust-toolchain.toml` files in the same manner that a
few projects are already doing. Finally additionally fix a build error
about not being able to find `-lc++` by linking with `clang` by default
instead of `cc`, rustc's default.
  • Loading branch information
alexcrichton committed Jun 17, 2024
1 parent d84f88b commit caf1ff5
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 15 deletions.
11 changes: 11 additions & 0 deletions infra/base-images/base-builder-rust/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions infra/base-images/base-builder/install_rust.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/
2 changes: 1 addition & 1 deletion projects/askama/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion projects/crosvm/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions projects/gitoxide/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion projects/linkerd2-proxy/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion projects/naga/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/
2 changes: 1 addition & 1 deletion projects/opendal/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=(
Expand Down
4 changes: 0 additions & 4 deletions projects/opensk/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit caf1ff5

Please sign in to comment.