Merge cranelift/wasmtime fuzzing
This commit is contained in:
11
cranelift/.github/workflows/main.yml
vendored
11
cranelift/.github/workflows/main.yml
vendored
@@ -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
|
||||
|
||||
@@ -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"
|
||||
Binary file not shown.
@@ -1,12 +0,0 @@
|
||||
#![no_main]
|
||||
#[macro_use]
|
||||
extern crate libfuzzer_sys;
|
||||
extern crate cranelift_reader;
|
||||
use std::str;
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
if let Ok(s) = str::from_utf8(data) {
|
||||
let options = cranelift_reader::ParseOptions::default();
|
||||
let _ = cranelift_reader::parse_test(s, options);
|
||||
}
|
||||
});
|
||||
@@ -1,25 +0,0 @@
|
||||
#![no_main]
|
||||
|
||||
#[macro_use]
|
||||
extern crate libfuzzer_sys;
|
||||
extern crate binaryen;
|
||||
extern crate cranelift_codegen;
|
||||
extern crate cranelift_wasm;
|
||||
#[macro_use]
|
||||
extern crate target_lexicon;
|
||||
|
||||
use cranelift_codegen::{isa, settings};
|
||||
use cranelift_wasm::{translate_module, DummyEnvironment, ReturnMode};
|
||||
use std::str::FromStr;
|
||||
|
||||
fuzz_target!(|data: &[u8]| {
|
||||
let binaryen_module = binaryen::tools::translate_to_fuzz_mvp(data);
|
||||
|
||||
let wasm = binaryen_module.write();
|
||||
|
||||
let flags = settings::Flags::new(settings::builder());
|
||||
let triple = triple!("x86_64");
|
||||
let isa = isa::lookup(triple).unwrap().finish(flags);
|
||||
let mut dummy_environ = DummyEnvironment::new(isa.frontend_config(), ReturnMode::NormalReturns, false);
|
||||
translate_module(&wasm, &mut dummy_environ).unwrap();
|
||||
});
|
||||
Reference in New Issue
Block a user