From 3e2cdc3dedaf41d174db729a6b46cc5751b7118a Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Tue, 25 Feb 2020 11:18:23 -0800 Subject: [PATCH] Merge cranelift/wasmtime fuzzing --- .github/workflows/main.yml | 10 ++++++ Cargo.lock | 12 +++++++ cranelift/.github/workflows/main.yml | 11 ------- cranelift/fuzz/Cargo.toml | 30 ------------------ .../ffaefab69523eb11935a9b420d58826c8ea65c4c | Bin 2375 -> 0 bytes cranelift/fuzz/fuzz_translate_module.rs | 25 --------------- fuzz/Cargo.toml | 20 ++++++++++-- .../fuzz_targets/reader_parse_test.rs | 6 ++-- fuzz/fuzz_targets/translate_module.rs | 17 ++++++++++ 9 files changed, 60 insertions(+), 71 deletions(-) delete mode 100644 cranelift/fuzz/Cargo.toml delete mode 100644 cranelift/fuzz/corpus/fuzz_translate_module/ffaefab69523eb11935a9b420d58826c8ea65c4c delete mode 100644 cranelift/fuzz/fuzz_translate_module.rs rename cranelift/fuzz/fuzz_reader_parse_test.rs => fuzz/fuzz_targets/reader_parse_test.rs (76%) create mode 100644 fuzz/fuzz_targets/translate_module.rs diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f1679f2e79..68ecc9d998 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -107,6 +107,16 @@ jobs: | shuf \ | head -n 100 \ | xargs cargo fuzz run differential --release --debug-assertions + - run: | + find fuzz/corpus/reader_parse_test -type f \ + | shuf \ + | head -n 100 \ + | xargs cargo fuzz run reader_parse_test --release --debug-assertions + - run: | + find fuzz/corpus/translate_module -type f \ + | shuf \ + | head -n 100 \ + | xargs cargo fuzz run translate_module --release --debug-assertions # Install wasm32-unknown-emscripten target, and ensure `crates/wasi-common` # compiles to Emscripten. diff --git a/Cargo.lock b/Cargo.lock index 3a4b15a1f8..debe8fbd6a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -420,6 +420,14 @@ dependencies = [ "target-lexicon", ] +[[package]] +name = "cranelift-reader" +version = "0.59.0" +dependencies = [ + "cranelift-codegen", + "target-lexicon", +] + [[package]] name = "cranelift-wasm" version = "0.59.0" @@ -2114,7 +2122,11 @@ name = "wasmtime-fuzz" version = "0.12.0" dependencies = [ "arbitrary 0.2.0", + "cranelift-codegen", + "cranelift-reader", + "cranelift-wasm", "libfuzzer-sys", + "target-lexicon", "wasmtime", "wasmtime-fuzzing", ] diff --git a/cranelift/.github/workflows/main.yml b/cranelift/.github/workflows/main.yml index ac1fffb5dc..529c16f2c3 100644 --- a/cranelift/.github/workflows/main.yml +++ b/cranelift/.github/workflows/main.yml @@ -14,17 +14,6 @@ jobs: - run: find ./target/doc -maxdepth 1 -type d -name "cranelift*" | xargs -I{} cargo deadlinks --dir {} name: Run cargo-deadlinks - # Ensure fuzzer works by running it with a single input - - run: cargo install cargo-fuzz - if: matrix.rust == 'nightly' - - run: | - fuzz_module="ffaefab69523eb11935a9b420d58826c8ea65c4c" - cargo fuzz run fuzz_translate_module fuzz/corpus/fuzz_translate_module/$fuzz_module - env: - RUST_BACKTRACE: 1 - if: matrix.rust == 'nightly' - continue-on-error: true - meta_determinist_check: name: Meta deterministic check runs-on: ubuntu-latest diff --git a/cranelift/fuzz/Cargo.toml b/cranelift/fuzz/Cargo.toml deleted file mode 100644 index 948a07abc9..0000000000 --- a/cranelift/fuzz/Cargo.toml +++ /dev/null @@ -1,30 +0,0 @@ -[package] -name = "clif-wasm-fuzz" -version = "0.0.1" -authors = ["foote@fastly.com"] -publish = false -edition = "2018" - -[package.metadata] -cargo-fuzz = true - -[dependencies] -cargo-fuzz = "*" -binaryen = { git = "https://github.com/pepyakin/binaryen-rs.git" } -libfuzzer-sys = { git = "https://github.com/rust-fuzz/libfuzzer-sys.git" } -cranelift-codegen = { path = "../codegen" } -cranelift-wasm = { path = "../wasm" } -cranelift-reader = { path = "../reader" } -target-lexicon = "0.10" - -# Prevent this from interfering with workspaces -[workspace] -members = ["."] - -[[bin]] -name = "fuzz_translate_module" -path = "fuzz_translate_module.rs" - -[[bin]] -name = "fuzz_reader_parse_test" -path = "fuzz_reader_parse_test.rs" diff --git a/cranelift/fuzz/corpus/fuzz_translate_module/ffaefab69523eb11935a9b420d58826c8ea65c4c b/cranelift/fuzz/corpus/fuzz_translate_module/ffaefab69523eb11935a9b420d58826c8ea65c4c deleted file mode 100644 index 1fa4159954301b3074cab3e33e46da5f826c0bc5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2375 zcmdPpVi*OZAwY)^2nB)!5CH}MX#{{?`HsVACb&4v5yaDegp|54q6Q*JJ*vnk4^Ie0 z