aboutsummaryrefslogtreecommitdiff
path: root/projects/wasmtime
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2020-07-10 21:25:01 -0500
committerGitHub <noreply@github.com>2020-07-10 19:25:01 -0700
commitcd665e2a82a84a3bfdb176662861200e8ad4364d (patch)
tree5f185bbc1ebf7b157850811579b44f544ae625d8 /projects/wasmtime
parent58e519a8f22ae04ff5833ff2da8524baa27a3d67 (diff)
downloadoss-fuzz-cd665e2a82a84a3bfdb176662861200e8ad4364d.tar.gz
Add wasm-tools repository to wasmtime project (#4111)
* Add wasm-tools repository to wasmtime project This commit expands the fuzzers run under the Wasmtime project to include those in the https://github.com/bytecodealliance/wasm-tools repository. This includes various parsing for utilities used by Wasmtime itself but also generally useful for other Rust projects! The maintainers of the wasm-tools repository are also all currently all on the notification list for Wasmtime fuzz bugs as well. * Load all corpuses from wasmtime-libfuzzer-corpus
Diffstat (limited to 'projects/wasmtime')
-rw-r--r--projects/wasmtime/Dockerfile2
-rwxr-xr-xprojects/wasmtime/build.sh44
2 files changed, 30 insertions, 16 deletions
diff --git a/projects/wasmtime/Dockerfile b/projects/wasmtime/Dockerfile
index aed6bd603..78280a088 100644
--- a/projects/wasmtime/Dockerfile
+++ b/projects/wasmtime/Dockerfile
@@ -17,6 +17,8 @@
FROM gcr.io/oss-fuzz-base/base-builder
RUN apt-get update && apt-get install -y make autoconf automake libtool curl cmake python llvm-dev libclang-dev clang
+RUN git clone --depth 1 https://github.com/bytecodealliance/wasm-tools wasm-tools
+
RUN git clone --depth 1 https://github.com/bytecodealliance/wasmtime wasmtime
WORKDIR wasmtime
RUN git submodule update --init --recursive
diff --git a/projects/wasmtime/build.sh b/projects/wasmtime/build.sh
index 59b5df68e..16ff24bbc 100755
--- a/projects/wasmtime/build.sh
+++ b/projects/wasmtime/build.sh
@@ -16,24 +16,36 @@
################################################################################
# Note: This project creates Rust fuzz targets exclusively
-PROJECT_DIR=$SRC/wasmtime
-# Build with all features to enable the binaryen-using fuzz targets, and
-# the peepmatic fuzz targets.
-cd $PROJECT_DIR/fuzz && cargo fuzz build -O --debug-assertions --all-features
+build() {
+ project=$1
+ shift
+ fuzzer_prefix=$1
+ shift
+ PROJECT_DIR=$SRC/$project
+
+ cd $PROJECT_DIR/fuzz && cargo fuzz build -O --debug-assertions "$@"
+
+ FUZZ_TARGET_OUTPUT_DIR=$PROJECT_DIR/target/x86_64-unknown-linux-gnu/release
-FUZZ_TARGET_OUTPUT_DIR=$PROJECT_DIR/target/x86_64-unknown-linux-gnu/release
+ for f in $PROJECT_DIR/fuzz/fuzz_targets/*.rs
+ do
+ src_name=$(basename ${f%.*})
+ dst_name=$fuzzer_prefix$src_name
+ cp $FUZZ_TARGET_OUTPUT_DIR/$src_name $OUT/$dst_name
-for f in $SRC/wasmtime/fuzz/fuzz_targets/*.rs
-do
- FUZZ_TARGET_NAME=$(basename ${f%.*})
- cp $FUZZ_TARGET_OUTPUT_DIR/$FUZZ_TARGET_NAME $OUT/
+ if [[ -d $SRC/wasmtime/wasmtime-libfuzzer-corpus/$dst_name/ ]]; then
+ zip -jr \
+ $OUT/${dst_name}_seed_corpus.zip \
+ $SRC/wasmtime/wasmtime-libfuzzer-corpus/$dst_name/
+ fi
- if [[ -d $PROJECT_DIR/wasmtime-libfuzzer-corpus/$FUZZ_TARGET_NAME/ ]]; then
- zip -jr \
- $OUT/${FUZZ_TARGET_NAME}_seed_corpus.zip \
- $PROJECT_DIR/wasmtime-libfuzzer-corpus/$FUZZ_TARGET_NAME/
- fi
+ cp $SRC/default.options $OUT/$dst_name.options
+ done
+}
+
+# Build with all features to enable the binaryen-using fuzz targets, and
+# the peepmatic fuzz targets.
+build wasmtime "" --all-features
- cp $SRC/default.options $OUT/$FUZZ_TARGET_NAME.options
-done
+build wasm-tools wasm-tools-