Bump deps and fix Clippy warns in example fuzzers (#1043)
* Mostly addressing changing the `uninlined_format_args` lint which was changed to warn-by-default in rust clippy 1.67 * Bump dependencies: bindgen: 0.61 -> 0.63 cc: 1.0 -> 1.0.42 (Exclue versions w/incompat rayon dependency) clap: 3.x -> 4.0 rangemap: 0.1 -> 1 xz -> xz2: move to updated version * Add fallthrough default return to `LLVMFuzzerTestOneInput` in **/fuzz.c to prevent Clang's -Wreturn-type * libafl_atheris: Improve POSIX compatibility and reduce warnings * Check for .dylib and .so libraries * `source` -> `.` for POSIX shells * install wheel into the venv to support newer Python packaging standards * `LDPRELOAD` -> `LD_PRELOAD`
This commit is contained in:
parent
48caffb802
commit
5d76707ede
@ -118,6 +118,6 @@ match Launcher::builder()
|
|||||||
{
|
{
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(Error::ShuttingDown) => println!("Fuzzing stopped by user. Good bye."),
|
Err(Error::ShuttingDown) => println!("Fuzzing stopped by user. Good bye."),
|
||||||
Err(err) => panic!("Failed to run launcher: {:?}", err),
|
Err(err) => panic!("Failed to run launcher: {err:?}"),
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -136,7 +136,7 @@ Another required component is the **EventManager**. It handles some events such
|
|||||||
|
|
||||||
```rust,ignore
|
```rust,ignore
|
||||||
// The Monitor trait defines how the fuzzer stats are displayed to the user
|
// The Monitor trait defines how the fuzzer stats are displayed to the user
|
||||||
let mon = SimpleMonitor::new(|s| println!("{}", s));
|
let mon = SimpleMonitor::new(|s| println!("{s}"));
|
||||||
|
|
||||||
// The event manager handle the various events generated during the fuzzing loop
|
// The event manager handle the various events generated during the fuzzing loop
|
||||||
// such as the notification of the addition of a new item to the corpus
|
// such as the notification of the addition of a new item to the corpus
|
||||||
|
@ -21,7 +21,7 @@ debug = true
|
|||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
anyhow = "1"
|
anyhow = "1"
|
||||||
bindgen = "0.61"
|
bindgen = "0.63"
|
||||||
cc = "1.0"
|
cc = "1.0"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
#![no_std]
|
#![no_std]
|
||||||
// Embedded targets: build with no_main
|
// Embedded targets: build with no_main
|
||||||
#![cfg_attr(not(any(windows)), no_main)]
|
#![cfg_attr(not(any(windows)), no_main)]
|
||||||
// Embedded needs alloc error handlers which only work on nightly right now...
|
|
||||||
#![cfg_attr(not(any(windows)), feature(default_alloc_error_handler))]
|
|
||||||
|
|
||||||
#[cfg(any(windows, unix))]
|
#[cfg(any(windows, unix))]
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
|
@ -15,4 +15,4 @@ opt-level = 3
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
libafl = { path = "../../../libafl/" }
|
libafl = { path = "../../../libafl/" }
|
||||||
clap = { version = "3.2", features = ["default"] }
|
clap = { version = "4.0", features = ["default"] }
|
@ -15,10 +15,10 @@ opt-level = 3
|
|||||||
debug = true
|
debug = true
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
cc = { version = "1.0", features = ["parallel"] }
|
cc = { version = "1.0.42", features = ["parallel"] }
|
||||||
num_cpus = "1.0"
|
num_cpus = "1.0"
|
||||||
which = "4.1"
|
which = "4.1"
|
||||||
xz = "0.1.0"
|
xz2 = "0.1.6"
|
||||||
flate2 = "1.0.22"
|
flate2 = "1.0.22"
|
||||||
tar = "0.4.37"
|
tar = "0.4.37"
|
||||||
reqwest = { version = "0.11.4", features = ["blocking"] }
|
reqwest = { version = "0.11.4", features = ["blocking"] }
|
||||||
@ -32,7 +32,7 @@ libafl_targets = { path = "../../libafl_targets", features = ["sancov_cmplog"] }
|
|||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
libloading = "0.7"
|
libloading = "0.7"
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
rangemap = "0.1"
|
rangemap = "1"
|
||||||
clap = { version = "4.0", features = ["derive"] }
|
clap = { version = "4.0", features = ["derive"] }
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
mimalloc = { version = "*", default-features = false }
|
mimalloc = { version = "*", default-features = false }
|
||||||
|
@ -15,9 +15,9 @@ opt-level = 3
|
|||||||
debug = true
|
debug = true
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
cc = { version = "1.0", features = ["parallel"] }
|
cc = { version = "1.0.42", features = ["parallel"] }
|
||||||
which = "4.1"
|
which = "4.1"
|
||||||
xz = "0.1.0"
|
xz2 = "0.1.6"
|
||||||
flate2 = "1.0.22"
|
flate2 = "1.0.22"
|
||||||
tar = "0.4.37"
|
tar = "0.4.37"
|
||||||
reqwest = { version = "0.11.4", features = ["blocking"] }
|
reqwest = { version = "0.11.4", features = ["blocking"] }
|
||||||
@ -34,7 +34,7 @@ libafl_targets = { path = "../../libafl_targets", features = ["sancov_cmplog"] }
|
|||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
libloading = "0.7"
|
libloading = "0.7"
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
rangemap = "0.1"
|
rangemap = "1"
|
||||||
clap = { version = "4.0", features = ["derive"] }
|
clap = { version = "4.0", features = ["derive"] }
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
mimalloc = { version = "*", default-features = false }
|
mimalloc = { version = "*", default-features = false }
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
||||||
if (Size >= 8 && *(uint32_t *)Data == 0xaabbccdd) { abort(); }
|
if (Size >= 8 && *(uint32_t *)Data == 0xaabbccdd) { abort(); }
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -14,5 +14,5 @@ debug = true
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
libafl = { path = "../../libafl/" }
|
libafl = { path = "../../libafl/" }
|
||||||
libafl_qemu = { path = "../../libafl_qemu/", features = ["x86_64", "usermode"] }
|
libafl_qemu = { path = "../../libafl_qemu/", features = ["x86_64", "usermode"] }
|
||||||
clap = { version = "3.2", features = ["default"] }
|
clap = { version = "4.0", features = ["default"] }
|
||||||
nix = "0.25"
|
nix = "0.25"
|
||||||
|
@ -70,21 +70,18 @@ pub fn main() {
|
|||||||
Arg::new("out")
|
Arg::new("out")
|
||||||
.help("The directory to place finds in ('corpus')")
|
.help("The directory to place finds in ('corpus')")
|
||||||
.long("libafl-out")
|
.long("libafl-out")
|
||||||
.required(true)
|
.required(true),
|
||||||
.takes_value(true),
|
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("in")
|
Arg::new("in")
|
||||||
.help("The directory to read initial inputs from ('seeds')")
|
.help("The directory to read initial inputs from ('seeds')")
|
||||||
.long("libafl-in")
|
.long("libafl-in")
|
||||||
.required(true)
|
.required(true),
|
||||||
.takes_value(true),
|
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("tokens")
|
Arg::new("tokens")
|
||||||
.long("libafl-tokens")
|
.long("libafl-tokens")
|
||||||
.help("A file to read tokens from, to be used during fuzzing")
|
.help("A file to read tokens from, to be used during fuzzing"),
|
||||||
.takes_value(true),
|
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("logfile")
|
Arg::new("logfile")
|
||||||
@ -158,7 +155,7 @@ fn fuzz(
|
|||||||
let test_one_input_ptr = elf
|
let test_one_input_ptr = elf
|
||||||
.resolve_symbol("LLVMFuzzerTestOneInput", emu.load_addr())
|
.resolve_symbol("LLVMFuzzerTestOneInput", emu.load_addr())
|
||||||
.expect("Symbol LLVMFuzzerTestOneInput not found");
|
.expect("Symbol LLVMFuzzerTestOneInput not found");
|
||||||
println!("LLVMFuzzerTestOneInput @ {:#x}", test_one_input_ptr);
|
println!("LLVMFuzzerTestOneInput @ {test_one_input_ptr:#x}");
|
||||||
|
|
||||||
emu.set_breakpoint(test_one_input_ptr); // LLVMFuzzerTestOneInput
|
emu.set_breakpoint(test_one_input_ptr); // LLVMFuzzerTestOneInput
|
||||||
unsafe { emu.run() };
|
unsafe { emu.run() };
|
||||||
@ -170,14 +167,14 @@ fn fuzz(
|
|||||||
unsafe { emu.read_mem(stack_ptr, &mut ret_addr) };
|
unsafe { emu.read_mem(stack_ptr, &mut ret_addr) };
|
||||||
let ret_addr = u64::from_le_bytes(ret_addr);
|
let ret_addr = u64::from_le_bytes(ret_addr);
|
||||||
|
|
||||||
println!("Stack pointer = {:#x}", stack_ptr);
|
println!("Stack pointer = {stack_ptr:#x}");
|
||||||
println!("Return address = {:#x}", ret_addr);
|
println!("Return address = {ret_addr:#x}");
|
||||||
|
|
||||||
emu.remove_breakpoint(test_one_input_ptr); // LLVMFuzzerTestOneInput
|
emu.remove_breakpoint(test_one_input_ptr); // LLVMFuzzerTestOneInput
|
||||||
emu.set_breakpoint(ret_addr); // LLVMFuzzerTestOneInput ret addr
|
emu.set_breakpoint(ret_addr); // LLVMFuzzerTestOneInput ret addr
|
||||||
|
|
||||||
let input_addr = emu.map_private(0, 4096, MmapPerms::ReadWrite).unwrap();
|
let input_addr = emu.map_private(0, 4096, MmapPerms::ReadWrite).unwrap();
|
||||||
println!("Placing input at {:#x}", input_addr);
|
println!("Placing input at {input_addr:#x}");
|
||||||
|
|
||||||
let log = RefCell::new(
|
let log = RefCell::new(
|
||||||
OpenOptions::new()
|
OpenOptions::new()
|
||||||
|
@ -14,5 +14,5 @@ debug = true
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
libafl = { path = "../../libafl/" }
|
libafl = { path = "../../libafl/" }
|
||||||
libafl_qemu = { path = "../../libafl_qemu/", features = ["x86_64", "usermode"] }
|
libafl_qemu = { path = "../../libafl_qemu/", features = ["x86_64", "usermode"] }
|
||||||
clap = { version = "3.2", features = ["default"] }
|
clap = { version = "4.0", features = ["default"] }
|
||||||
nix = "0.25"
|
nix = "0.25"
|
||||||
|
@ -78,21 +78,18 @@ pub fn main() {
|
|||||||
Arg::new("out")
|
Arg::new("out")
|
||||||
.help("The directory to place finds in ('corpus')")
|
.help("The directory to place finds in ('corpus')")
|
||||||
.long("libafl-out")
|
.long("libafl-out")
|
||||||
.required(true)
|
.required(true),
|
||||||
.takes_value(true),
|
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("in")
|
Arg::new("in")
|
||||||
.help("The directory to read initial inputs from ('seeds')")
|
.help("The directory to read initial inputs from ('seeds')")
|
||||||
.long("libafl-in")
|
.long("libafl-in")
|
||||||
.required(true)
|
.required(true),
|
||||||
.takes_value(true),
|
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("tokens")
|
Arg::new("tokens")
|
||||||
.long("libafl-tokens")
|
.long("libafl-tokens")
|
||||||
.help("A file to read tokens from, to be used during fuzzing")
|
.help("A file to read tokens from, to be used during fuzzing"),
|
||||||
.takes_value(true),
|
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("logfile")
|
Arg::new("logfile")
|
||||||
@ -183,7 +180,7 @@ fn fuzz(
|
|||||||
let test_one_input_ptr = elf
|
let test_one_input_ptr = elf
|
||||||
.resolve_symbol("LLVMFuzzerTestOneInput", emu.load_addr())
|
.resolve_symbol("LLVMFuzzerTestOneInput", emu.load_addr())
|
||||||
.expect("Symbol LLVMFuzzerTestOneInput not found");
|
.expect("Symbol LLVMFuzzerTestOneInput not found");
|
||||||
println!("LLVMFuzzerTestOneInput @ {:#x}", test_one_input_ptr);
|
println!("LLVMFuzzerTestOneInput @ {test_one_input_ptr:#x}");
|
||||||
|
|
||||||
emu.set_breakpoint(test_one_input_ptr); // LLVMFuzzerTestOneInput
|
emu.set_breakpoint(test_one_input_ptr); // LLVMFuzzerTestOneInput
|
||||||
unsafe { emu.run() };
|
unsafe { emu.run() };
|
||||||
@ -195,8 +192,8 @@ fn fuzz(
|
|||||||
unsafe { emu.read_mem(stack_ptr, &mut ret_addr) };
|
unsafe { emu.read_mem(stack_ptr, &mut ret_addr) };
|
||||||
let ret_addr = u64::from_le_bytes(ret_addr);
|
let ret_addr = u64::from_le_bytes(ret_addr);
|
||||||
|
|
||||||
println!("Stack pointer = {:#x}", stack_ptr);
|
println!("Stack pointer = {stack_ptr:#x}");
|
||||||
println!("Return address = {:#x}", ret_addr);
|
println!("Return address = {ret_addr:#x}");
|
||||||
|
|
||||||
emu.remove_breakpoint(test_one_input_ptr); // LLVMFuzzerTestOneInput
|
emu.remove_breakpoint(test_one_input_ptr); // LLVMFuzzerTestOneInput
|
||||||
emu.set_breakpoint(ret_addr); // LLVMFuzzerTestOneInput ret addr
|
emu.set_breakpoint(ret_addr); // LLVMFuzzerTestOneInput ret addr
|
||||||
@ -204,7 +201,7 @@ fn fuzz(
|
|||||||
let input_addr = emu
|
let input_addr = emu
|
||||||
.map_private(0, MAX_INPUT_SIZE, MmapPerms::ReadWrite)
|
.map_private(0, MAX_INPUT_SIZE, MmapPerms::ReadWrite)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
println!("Placing input at {:#x}", input_addr);
|
println!("Placing input at {input_addr:#x}");
|
||||||
|
|
||||||
let log = RefCell::new(
|
let log = RefCell::new(
|
||||||
OpenOptions::new()
|
OpenOptions::new()
|
||||||
@ -224,7 +221,7 @@ fn fuzz(
|
|||||||
// 'While the stats are state, they are usually used in the broker - which is likely never restarted
|
// 'While the stats are state, they are usually used in the broker - which is likely never restarted
|
||||||
let monitor = SimpleMonitor::new(|s| {
|
let monitor = SimpleMonitor::new(|s| {
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
writeln!(&mut stdout_cpy, "{}", s).unwrap();
|
writeln!(&mut stdout_cpy, "{s}").unwrap();
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
println!("{s}");
|
println!("{s}");
|
||||||
writeln!(log.borrow_mut(), "{:?} {}", current_time(), s).unwrap();
|
writeln!(log.borrow_mut(), "{:?} {}", current_time(), s).unwrap();
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
||||||
if (Size >= 8 && *(uint32_t *)Data == 0xaabbccdd) { abort(); }
|
if (Size >= 8 && *(uint32_t *)Data == 0xaabbccdd) { abort(); }
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -278,7 +278,7 @@ fn fuzz_binary(
|
|||||||
// 'While the monitor are state, they are usually used in the broker - which is likely never restarted
|
// 'While the monitor are state, they are usually used in the broker - which is likely never restarted
|
||||||
let monitor = SimpleMonitor::new(|s| {
|
let monitor = SimpleMonitor::new(|s| {
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
writeln!(&mut stdout_cpy, "{}", s).unwrap();
|
writeln!(&mut stdout_cpy, "{s}").unwrap();
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
println!("{s}");
|
println!("{s}");
|
||||||
writeln!(log.borrow_mut(), "{:?} {}", current_time(), s).unwrap();
|
writeln!(log.borrow_mut(), "{:?} {}", current_time(), s).unwrap();
|
||||||
@ -479,7 +479,7 @@ fn fuzz_text(
|
|||||||
// 'While the monitor are state, they are usually used in the broker - which is likely never restarted
|
// 'While the monitor are state, they are usually used in the broker - which is likely never restarted
|
||||||
let monitor = SimpleMonitor::new(|s| {
|
let monitor = SimpleMonitor::new(|s| {
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
writeln!(&mut stdout_cpy, "{}", s).unwrap();
|
writeln!(&mut stdout_cpy, "{s}").unwrap();
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
println!("{s}");
|
println!("{s}");
|
||||||
writeln!(log.borrow_mut(), "{:?} {}", current_time(), s).unwrap();
|
writeln!(log.borrow_mut(), "{:?} {}", current_time(), s).unwrap();
|
||||||
|
@ -21,7 +21,7 @@ which = { version = "4.0.2" }
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
libafl = { path = "../../libafl/" }
|
libafl = { path = "../../libafl/" }
|
||||||
libafl_targets = { path = "../../libafl_targets/", features = ["pointer_maps", "sancov_cmplog", "libfuzzer"] }
|
libafl_targets = { path = "../../libafl_targets/", features = ["pointer_maps", "sancov_cmplog", "libfuzzer"] }
|
||||||
clap = { version = "3.2", features = ["default"] }
|
clap = { version = "4.0", features = ["default"] }
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "afl_atheris"
|
name = "afl_atheris"
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
FUZZER_NAME="fuzzer"
|
|
||||||
PROJECT_DIR=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
PROJECT_DIR=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
|
||||||
UNAME :="$(shell uname)"
|
UNAME :="$(shell uname)"
|
||||||
LIB_DIR :="$(PROJECT_DIR)/target/release/libafl_atheris.a"
|
LIB_DIR :="$(PROJECT_DIR)/target/release/libafl_atheris.a"
|
||||||
DEEXIT_PATH = "$(PROJECT_DIR)/../../target/release/libdeexit.dylib"
|
DEEXIT_PATH = "$(PROJECT_DIR)/../../target/release/libdeexit.dylib"
|
||||||
|
|
||||||
|
ifeq ("$(wildcard $(DEEXIT_PATH))", "")
|
||||||
|
DEEXIT_PATH = "$(PROJECT_DIR)/../../target/release/libdeexit.so"
|
||||||
|
endif
|
||||||
|
|
||||||
PHONY: all
|
PHONY: all
|
||||||
|
|
||||||
all: fuzzer deexit
|
all: fuzzer deexit
|
||||||
@ -22,7 +25,8 @@ target/release/libafl_atheris.a: src/*
|
|||||||
|
|
||||||
fuzzer: target/release/libafl_atheris.a atheris env
|
fuzzer: target/release/libafl_atheris.a atheris env
|
||||||
(\
|
(\
|
||||||
source env/bin/activate; \
|
. env/bin/activate; \
|
||||||
|
pip install wheel; \
|
||||||
cd atheris; \
|
cd atheris; \
|
||||||
LIBFUZZER_LIB=$(LIB_DIR) pip install .; \
|
LIBFUZZER_LIB=$(LIB_DIR) pip install .; \
|
||||||
)
|
)
|
||||||
@ -30,25 +34,21 @@ fuzzer: target/release/libafl_atheris.a atheris env
|
|||||||
clean:
|
clean:
|
||||||
rm env
|
rm env
|
||||||
|
|
||||||
run: all
|
|
||||||
./$(FUZZER_NAME) --cores 0 &
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
python3 -m pip install --user virtualenv
|
|
||||||
python3 -m venv env
|
python3 -m venv env
|
||||||
|
|
||||||
short_test: all
|
short_test: all
|
||||||
(\
|
(\
|
||||||
rm -rf libafl_unix_shmem_server || true; \
|
rm -rf libafl_unix_shmem_server || true; \
|
||||||
source env/bin/activate; \
|
. env/bin/activate; \
|
||||||
LDPRELOAD=$(DEEXIT_PATH) DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_INSERT_LIBRARIES=$(DEEXIT_PATH) RUST_BACKTRACE=1 timeout 10s python3 ./atheris/example_fuzzers/fuzzing_example.py --cores 0 -i in -o out || true; \
|
LD_PRELOAD=$(DEEXIT_PATH) DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_INSERT_LIBRARIES=$(DEEXIT_PATH) RUST_BACKTRACE=1 timeout 10s python3 ./atheris/example_fuzzers/fuzzing_example.py --cores 0 -i in -o out || true; \
|
||||||
rm -rf out; \
|
rm -rf out; \
|
||||||
)
|
)
|
||||||
|
|
||||||
test: all
|
test:
|
||||||
(\
|
(\
|
||||||
rm -rf libafl_unix_shmem_server || true; \
|
rm -rf libafl_unix_shmem_server || true; \
|
||||||
source env/bin/activate; \
|
. env/bin/activate; \
|
||||||
LDPRELOAD=$(DEEXIT_PATH) DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_INSERT_LIBRARIES=$(DEEXIT_PATH) RUST_BACKTRACE=1 timeout 60s python3 ./atheris/example_fuzzers/fuzzing_example.py --cores 0 -i in -o out || true; \
|
LD_PRELOAD=$(DEEXIT_PATH) DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_INSERT_LIBRARIES=$(DEEXIT_PATH) RUST_BACKTRACE=1 timeout 60s python3 ./atheris/example_fuzzers/fuzzing_example.py --cores 0 -i in -o out || true; \
|
||||||
rm -rf out; \
|
rm -rf out; \
|
||||||
)
|
)
|
||||||
|
@ -10,7 +10,7 @@ use std::{
|
|||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
};
|
};
|
||||||
|
|
||||||
use clap::{AppSettings, Arg, Command};
|
use clap::{Arg, ArgAction, Command};
|
||||||
use libafl::{
|
use libafl::{
|
||||||
bolts::{
|
bolts::{
|
||||||
core_affinity::Cores,
|
core_affinity::Cores,
|
||||||
@ -74,8 +74,8 @@ pub fn __sanitizer_weak_hook_memcmp(
|
|||||||
_result: c_int,
|
_result: c_int,
|
||||||
) {
|
) {
|
||||||
unsafe {
|
unsafe {
|
||||||
let s1 = slice::from_raw_parts(s1 as *const u8, n);
|
let s1 = slice::from_raw_parts(s1.cast::<u8>(), n);
|
||||||
let s2 = slice::from_raw_parts(s2 as *const u8, n);
|
let s2 = slice::from_raw_parts(s2.cast::<u8>(), n);
|
||||||
match n {
|
match n {
|
||||||
0 => (),
|
0 => (),
|
||||||
1 => __sanitizer_cov_trace_cmp1(
|
1 => __sanitizer_cov_trace_cmp1(
|
||||||
@ -113,64 +113,46 @@ pub fn LLVMFuzzerRunDriver(
|
|||||||
// Needed only on no_std
|
// Needed only on no_std
|
||||||
//RegistryBuilder::register::<Tokens>();
|
//RegistryBuilder::register::<Tokens>();
|
||||||
|
|
||||||
if harness_fn.is_none() {
|
assert!(harness_fn.is_some(), "No harness callback provided");
|
||||||
panic!("No harness callback provided");
|
|
||||||
}
|
|
||||||
let harness_fn = harness_fn.unwrap();
|
let harness_fn = harness_fn.unwrap();
|
||||||
|
|
||||||
if unsafe { EDGES_MAP_PTR.is_null() } {
|
assert!(
|
||||||
panic!(
|
!unsafe { EDGES_MAP_PTR.is_null() },
|
||||||
"Edges map was never initialized - __sanitizer_cov_8bit_counters_init never got called"
|
"Edges map was never initialized - __sanitizer_cov_8bit_counters_init never got called"
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
|
||||||
println!("Args: {:?}", std::env::args());
|
println!("Args: {:?}", std::env::args());
|
||||||
|
|
||||||
let matches = Command::new("libafl_atheris")
|
let matches = Command::new("libafl_atheris")
|
||||||
.version("0.1.0")
|
.version("0.1.0")
|
||||||
.setting(AppSettings::AllowExternalSubcommands)
|
.allow_external_subcommands(true)
|
||||||
.arg(Arg::new("script")) // The python script is the first arg
|
.arg(Arg::new("script")) // The python script is the first arg
|
||||||
.arg(
|
.arg(Arg::new("cores").short('c').long("cores").required(true))
|
||||||
Arg::new("cores")
|
|
||||||
.short('c')
|
|
||||||
.long("cores")
|
|
||||||
.required(true)
|
|
||||||
.takes_value(true),
|
|
||||||
)
|
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("broker_port")
|
Arg::new("broker_port")
|
||||||
.short('p')
|
.short('p')
|
||||||
.long("broker-port")
|
.long("broker-port")
|
||||||
.required(false)
|
.required(false),
|
||||||
.takes_value(true),
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::new("output")
|
|
||||||
.short('o')
|
|
||||||
.long("output")
|
|
||||||
.required(false)
|
|
||||||
.takes_value(true),
|
|
||||||
)
|
)
|
||||||
|
.arg(Arg::new("output").short('o').long("output").required(false))
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("input")
|
Arg::new("input")
|
||||||
.short('i')
|
.short('i')
|
||||||
.long("input")
|
.long("input")
|
||||||
.required(true)
|
.required(true)
|
||||||
.takes_value(true),
|
.action(ArgAction::Append),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("remote_broker_addr")
|
Arg::new("remote_broker_addr")
|
||||||
.short('B')
|
.short('B')
|
||||||
.long("remote-broker-addr")
|
.long("remote-broker-addr")
|
||||||
.required(false)
|
.required(false),
|
||||||
.takes_value(true),
|
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("timeout")
|
Arg::new("timeout")
|
||||||
.short('t')
|
.short('t')
|
||||||
.long("timeout")
|
.long("timeout")
|
||||||
.required(false)
|
.required(false),
|
||||||
.takes_value(true),
|
|
||||||
)
|
)
|
||||||
.get_matches();
|
.get_matches();
|
||||||
|
|
||||||
@ -184,27 +166,24 @@ pub fn LLVMFuzzerRunDriver(
|
|||||||
.expect("No valid core count given!");
|
.expect("No valid core count given!");
|
||||||
let broker_port = matches
|
let broker_port = matches
|
||||||
.get_one::<String>("broker_port")
|
.get_one::<String>("broker_port")
|
||||||
.map(|s| s.parse().expect("Invalid broker port"))
|
.map_or(1337, |s| s.parse().expect("Invalid broker port"));
|
||||||
.unwrap_or(1337);
|
|
||||||
let remote_broker_addr = matches
|
let remote_broker_addr = matches
|
||||||
.get_one::<String>("remote_broker_addr")
|
.get_one::<String>("remote_broker_addr")
|
||||||
.map(|s| s.parse().expect("Invalid broker address"));
|
.map(|s| s.parse().expect("Invalid broker address"));
|
||||||
let input_dirs: Vec<PathBuf> = matches
|
let input_dirs: Vec<PathBuf> = matches
|
||||||
.values_of("input")
|
.get_many::<PathBuf>("input")
|
||||||
.map(|v| v.map(PathBuf::from).collect())
|
.map(|v| v.map(PathBuf::from).collect())
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
let output_dir = matches
|
let output_dir = matches
|
||||||
.get_one::<String>("output")
|
.get_one::<String>("output")
|
||||||
.map(PathBuf::from)
|
.map_or_else(|| workdir.clone(), PathBuf::from);
|
||||||
.unwrap_or_else(|| workdir.clone());
|
let token_files: Vec<PathBuf> = matches
|
||||||
let token_files: Vec<&str> = matches
|
.get_many::<PathBuf>("tokens")
|
||||||
.values_of("tokens")
|
.map(|v| v.map(PathBuf::from).collect())
|
||||||
.map(|v| v.collect())
|
|
||||||
.unwrap_or_default();
|
.unwrap_or_default();
|
||||||
let timeout_ms = matches
|
let timeout_ms = matches
|
||||||
.get_one::<String>("timeout")
|
.get_one::<String>("timeout")
|
||||||
.map(|s| s.parse().expect("Invalid timeout"))
|
.map_or(10000, |s| s.parse().expect("Invalid timeout"));
|
||||||
.unwrap_or(10000);
|
|
||||||
// let cmplog_enabled = matches.is_present("cmplog");
|
// let cmplog_enabled = matches.is_present("cmplog");
|
||||||
|
|
||||||
println!("Workdir: {:?}", workdir.to_string_lossy().to_string());
|
println!("Workdir: {:?}", workdir.to_string_lossy().to_string());
|
||||||
@ -369,6 +348,6 @@ pub fn LLVMFuzzerRunDriver(
|
|||||||
.launch()
|
.launch()
|
||||||
{
|
{
|
||||||
Ok(_) | Err(Error::ShuttingDown) => (),
|
Ok(_) | Err(Error::ShuttingDown) => (),
|
||||||
Err(e) => panic!("Error in fuzzer: {}", e),
|
Err(e) => panic!("Error in fuzzer: {e}"),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ fn fuzz(corpus_dirs: &[PathBuf], objective_dir: PathBuf, broker_port: u16) -> Re
|
|||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
panic!("Failed to setup the restarter: {:?}", err);
|
panic!("Failed to setup the restarter: {err:?}");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ pub fn main() {
|
|||||||
.link_staticlib(&dir, "libfuzzer_libpng")
|
.link_staticlib(&dir, "libfuzzer_libpng")
|
||||||
.add_arg("-fsanitize-coverage=trace-pc-guard")
|
.add_arg("-fsanitize-coverage=trace-pc-guard")
|
||||||
.add_pass(LLVMPasses::CoverageAccounting)
|
.add_pass(LLVMPasses::CoverageAccounting)
|
||||||
.add_passes_arg(format!("-granularity={}", GRANULARITY))
|
.add_passes_arg(format!("-granularity={GRANULARITY}"))
|
||||||
.run()
|
.run()
|
||||||
.expect("Failed to run the wrapped compiler")
|
.expect("Failed to run the wrapped compiler")
|
||||||
{
|
{
|
||||||
|
@ -253,6 +253,6 @@ pub fn libafl_main() {
|
|||||||
{
|
{
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(Error::ShuttingDown) => println!("Fuzzing stopped by user. Good bye."),
|
Err(Error::ShuttingDown) => println!("Fuzzing stopped by user. Good bye."),
|
||||||
Err(err) => panic!("Failed to run launcher: {:?}", err),
|
Err(err) => panic!("Failed to run launcher: {err:?}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -242,6 +242,6 @@ pub fn libafl_main() {
|
|||||||
{
|
{
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(Error::ShuttingDown) => println!("Fuzzing stopped by user. Good bye."),
|
Err(Error::ShuttingDown) => println!("Fuzzing stopped by user. Good bye."),
|
||||||
Err(err) => panic!("Failed to run launcher: {:?}", err),
|
Err(err) => panic!("Failed to run launcher: {err:?}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -247,6 +247,6 @@ pub fn libafl_main() {
|
|||||||
{
|
{
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(Error::ShuttingDown) => println!("Fuzzing stopped by user. Good bye."),
|
Err(Error::ShuttingDown) => println!("Fuzzing stopped by user. Good bye."),
|
||||||
Err(err) => panic!("Failed to run launcher: {:?}", err),
|
Err(err) => panic!("Failed to run launcher: {err:?}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ use libafl::{
|
|||||||
scheduled::{havoc_mutations, StdScheduledMutator},
|
scheduled::{havoc_mutations, StdScheduledMutator},
|
||||||
token_mutations::I2SRandReplace,
|
token_mutations::I2SRandReplace,
|
||||||
},
|
},
|
||||||
observers::{StdMapObserver, TimeObserver},
|
observers::TimeObserver,
|
||||||
schedulers::{IndexesLenTimeMinimizerScheduler, QueueScheduler},
|
schedulers::{IndexesLenTimeMinimizerScheduler, QueueScheduler},
|
||||||
stages::{ShadowTracingStage, StdMutationalStage},
|
stages::{ShadowTracingStage, StdMutationalStage},
|
||||||
state::{HasCorpus, StdState},
|
state::{HasCorpus, StdState},
|
||||||
@ -145,7 +145,7 @@ fn fuzz(corpus_dirs: &[PathBuf], objective_dir: PathBuf, broker_port: u16) -> Re
|
|||||||
if state.must_load_initial_inputs() {
|
if state.must_load_initial_inputs() {
|
||||||
state
|
state
|
||||||
.load_initial_inputs(&mut fuzzer, &mut executor, &mut restarting_mgr, corpus_dirs)
|
.load_initial_inputs(&mut fuzzer, &mut executor, &mut restarting_mgr, corpus_dirs)
|
||||||
.unwrap_or_else(|_| panic!("Failed to load initial corpus at {:?}", corpus_dirs));
|
.unwrap_or_else(|_| panic!("Failed to load initial corpus at {corpus_dirs:?}"));
|
||||||
println!("We imported {} inputs from disk.", state.corpus().count());
|
println!("We imported {} inputs from disk.", state.corpus().count());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ use libafl_cc::{ClangWrapper, CompilerWrapper};
|
|||||||
|
|
||||||
fn find_libpython() -> Result<String, String> {
|
fn find_libpython() -> Result<String, String> {
|
||||||
match Command::new("python3")
|
match Command::new("python3")
|
||||||
.args(&["-m", "find_libpython"])
|
.args(["-m", "find_libpython"])
|
||||||
.output()
|
.output()
|
||||||
{
|
{
|
||||||
Ok(output) => {
|
Ok(output) => {
|
||||||
|
@ -257,6 +257,6 @@ pub fn libafl_main() {
|
|||||||
{
|
{
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(Error::ShuttingDown) => println!("Fuzzing stopped by user. Good bye."),
|
Err(Error::ShuttingDown) => println!("Fuzzing stopped by user. Good bye."),
|
||||||
Err(err) => panic!("Failed to run launcher: {:?}", err),
|
Err(err) => panic!("Failed to run launcher: {err:?}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ fn main() {
|
|||||||
{
|
{
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(Error::ShuttingDown) => println!("Fuzzing stopped by user. Good bye."),
|
Err(Error::ShuttingDown) => println!("Fuzzing stopped by user. Good bye."),
|
||||||
Err(err) => panic!("Failed to run launcher: {:?}", err),
|
Err(err) => panic!("Failed to run launcher: {err:?}"),
|
||||||
}
|
}
|
||||||
|
|
||||||
// endregion
|
// endregion
|
||||||
|
@ -66,7 +66,7 @@ fn input_generator() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// The Monitor trait define how the fuzzer stats are reported to the user
|
// The Monitor trait define how the fuzzer stats are reported to the user
|
||||||
let monitor = SimpleMonitor::new(|s| println!("{}", s));
|
let monitor = SimpleMonitor::new(|s| println!("{s}"));
|
||||||
|
|
||||||
// The event manager handle the various events generated during the fuzzing loop
|
// The event manager handle the various events generated during the fuzzing loop
|
||||||
// such as the notification of the addition of a new item to the corpus
|
// such as the notification of the addition of a new item to the corpus
|
||||||
|
@ -60,7 +60,7 @@ pub fn main() {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
// The Monitor trait define how the fuzzer stats are reported to the user
|
// The Monitor trait define how the fuzzer stats are reported to the user
|
||||||
let monitor = SimpleMonitor::new(|s| println!("{}", s));
|
let monitor = SimpleMonitor::new(|s| println!("{s}"));
|
||||||
|
|
||||||
// The event manager handle the various events generated during the fuzzing loop
|
// The event manager handle the various events generated during the fuzzing loop
|
||||||
// such as the notification of the addition of a new item to the corpus
|
// such as the notification of the addition of a new item to the corpus
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
|
||||||
// printf("Got %ld bytes.\n", Size);
|
// printf("Got %ld bytes.\n", Size);
|
||||||
if (Size >= 4 && *(uint32_t *)Data == 0xaabbccdd) { abort(); }
|
if (Size >= 4 && *(uint32_t *)Data == 0xaabbccdd) { abort(); }
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
@ -62,7 +62,7 @@ pub fn fuzz() {
|
|||||||
let test_one_input_ptr = elf
|
let test_one_input_ptr = elf
|
||||||
.resolve_symbol("LLVMFuzzerTestOneInput", emu.load_addr())
|
.resolve_symbol("LLVMFuzzerTestOneInput", emu.load_addr())
|
||||||
.expect("Symbol LLVMFuzzerTestOneInput not found");
|
.expect("Symbol LLVMFuzzerTestOneInput not found");
|
||||||
println!("LLVMFuzzerTestOneInput @ {:#x}", test_one_input_ptr);
|
println!("LLVMFuzzerTestOneInput @ {test_one_input_ptr:#x}");
|
||||||
|
|
||||||
emu.set_breakpoint(test_one_input_ptr); // LLVMFuzzerTestOneInput
|
emu.set_breakpoint(test_one_input_ptr); // LLVMFuzzerTestOneInput
|
||||||
unsafe { emu.run() };
|
unsafe { emu.run() };
|
||||||
@ -73,14 +73,14 @@ pub fn fuzz() {
|
|||||||
let stack_ptr: u64 = emu.read_reg(Regs::Sp).unwrap();
|
let stack_ptr: u64 = emu.read_reg(Regs::Sp).unwrap();
|
||||||
let ret_addr: u32 = emu.read_reg(Regs::Lr).unwrap();
|
let ret_addr: u32 = emu.read_reg(Regs::Lr).unwrap();
|
||||||
|
|
||||||
println!("Stack pointer = {:#x}", stack_ptr);
|
println!("Stack pointer = {stack_ptr:#x}");
|
||||||
println!("Return address = {:#x}", ret_addr);
|
println!("Return address = {ret_addr:#x}");
|
||||||
|
|
||||||
emu.remove_breakpoint(test_one_input_ptr); // LLVMFuzzerTestOneInput
|
emu.remove_breakpoint(test_one_input_ptr); // LLVMFuzzerTestOneInput
|
||||||
emu.set_breakpoint(ret_addr); // LLVMFuzzerTestOneInput ret addr
|
emu.set_breakpoint(ret_addr); // LLVMFuzzerTestOneInput ret addr
|
||||||
|
|
||||||
let input_addr = emu.map_private(0, 4096, MmapPerms::ReadWrite).unwrap();
|
let input_addr = emu.map_private(0, 4096, MmapPerms::ReadWrite).unwrap();
|
||||||
println!("Placing input at {:#x}", input_addr);
|
println!("Placing input at {input_addr:#x}");
|
||||||
|
|
||||||
// The wrapped harness function, calling out to the LLVM-style harness
|
// The wrapped harness function, calling out to the LLVM-style harness
|
||||||
let mut harness = |input: &BytesInput| {
|
let mut harness = |input: &BytesInput| {
|
||||||
@ -233,6 +233,6 @@ pub fn fuzz() {
|
|||||||
{
|
{
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(Error::ShuttingDown) => println!("Fuzzing stopped by user. Good bye."),
|
Err(Error::ShuttingDown) => println!("Fuzzing stopped by user. Good bye."),
|
||||||
Err(err) => panic!("Failed to run launcher: {:?}", err),
|
Err(err) => panic!("Failed to run launcher: {err:?}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ pub fn fuzz() {
|
|||||||
let test_one_input_ptr = elf
|
let test_one_input_ptr = elf
|
||||||
.resolve_symbol("LLVMFuzzerTestOneInput", emu.load_addr())
|
.resolve_symbol("LLVMFuzzerTestOneInput", emu.load_addr())
|
||||||
.expect("Symbol LLVMFuzzerTestOneInput not found");
|
.expect("Symbol LLVMFuzzerTestOneInput not found");
|
||||||
println!("LLVMFuzzerTestOneInput @ {:#x}", test_one_input_ptr);
|
println!("LLVMFuzzerTestOneInput @ {test_one_input_ptr:#x}");
|
||||||
|
|
||||||
emu.set_breakpoint(test_one_input_ptr); // LLVMFuzzerTestOneInput
|
emu.set_breakpoint(test_one_input_ptr); // LLVMFuzzerTestOneInput
|
||||||
unsafe { emu.run() };
|
unsafe { emu.run() };
|
||||||
@ -75,8 +75,8 @@ pub fn fuzz() {
|
|||||||
unsafe { emu.read_mem(stack_ptr, &mut ret_addr) };
|
unsafe { emu.read_mem(stack_ptr, &mut ret_addr) };
|
||||||
let ret_addr = u64::from_le_bytes(ret_addr);
|
let ret_addr = u64::from_le_bytes(ret_addr);
|
||||||
|
|
||||||
println!("Stack pointer = {:#x}", stack_ptr);
|
println!("Stack pointer = {stack_ptr:#x}");
|
||||||
println!("Return address = {:#x}", ret_addr);
|
println!("Return address = {ret_addr:#x}");
|
||||||
|
|
||||||
emu.remove_breakpoint(test_one_input_ptr); // LLVMFuzzerTestOneInput
|
emu.remove_breakpoint(test_one_input_ptr); // LLVMFuzzerTestOneInput
|
||||||
emu.set_breakpoint(ret_addr); // LLVMFuzzerTestOneInput ret addr
|
emu.set_breakpoint(ret_addr); // LLVMFuzzerTestOneInput ret addr
|
||||||
@ -84,7 +84,7 @@ pub fn fuzz() {
|
|||||||
let input_addr = emu
|
let input_addr = emu
|
||||||
.map_private(0, MAX_INPUT_SIZE, MmapPerms::ReadWrite)
|
.map_private(0, MAX_INPUT_SIZE, MmapPerms::ReadWrite)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
println!("Placing input at {:#x}", input_addr);
|
println!("Placing input at {input_addr:#x}");
|
||||||
|
|
||||||
// The wrapped harness function, calling out to the LLVM-style harness
|
// The wrapped harness function, calling out to the LLVM-style harness
|
||||||
let mut harness = |input: &BytesInput| {
|
let mut harness = |input: &BytesInput| {
|
||||||
@ -214,6 +214,6 @@ pub fn fuzz() {
|
|||||||
{
|
{
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(Error::ShuttingDown) => println!("Fuzzing stopped by user. Good bye."),
|
Err(Error::ShuttingDown) => println!("Fuzzing stopped by user. Good bye."),
|
||||||
Err(err) => panic!("Failed to run launcher: {:?}", err),
|
Err(err) => panic!("Failed to run launcher: {err:?}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -61,12 +61,12 @@ pub fn fuzz() {
|
|||||||
0,
|
0,
|
||||||
)
|
)
|
||||||
.expect("Symbol or env FUZZ_INPUT not found") as GuestPhysAddr;
|
.expect("Symbol or env FUZZ_INPUT not found") as GuestPhysAddr;
|
||||||
println!("FUZZ_INPUT @ {:#x}", input_addr);
|
println!("FUZZ_INPUT @ {input_addr:#x}");
|
||||||
|
|
||||||
let main_addr = elf
|
let main_addr = elf
|
||||||
.resolve_symbol("main", 0)
|
.resolve_symbol("main", 0)
|
||||||
.expect("Symbol main not found");
|
.expect("Symbol main not found");
|
||||||
println!("main address = {:#x}", main_addr);
|
println!("main address = {main_addr:#x}");
|
||||||
|
|
||||||
let breakpoint = elf
|
let breakpoint = elf
|
||||||
.resolve_symbol(
|
.resolve_symbol(
|
||||||
@ -74,7 +74,7 @@ pub fn fuzz() {
|
|||||||
0,
|
0,
|
||||||
)
|
)
|
||||||
.expect("Symbol or env BREAKPOINT not found");
|
.expect("Symbol or env BREAKPOINT not found");
|
||||||
println!("Breakpoint address = {:#x}", breakpoint);
|
println!("Breakpoint address = {breakpoint:#x}");
|
||||||
|
|
||||||
let mut run_client = |state: Option<_>, mut mgr, _core_id| {
|
let mut run_client = |state: Option<_>, mut mgr, _core_id| {
|
||||||
// Initialize QEMU
|
// Initialize QEMU
|
||||||
@ -248,6 +248,6 @@ pub fn fuzz() {
|
|||||||
{
|
{
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(Error::ShuttingDown) => println!("Fuzzing stopped by user. Good bye."),
|
Err(Error::ShuttingDown) => println!("Fuzzing stopped by user. Good bye."),
|
||||||
Err(err) => panic!("Failed to run launcher: {:?}", err),
|
Err(err) => panic!("Failed to run launcher: {err:?}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,18 +38,14 @@ impl Fixup for PacketData {
|
|||||||
Serialize, Deserialize, Debug, Copy, Clone, FuzzerObject, ToPrimitiveU32, BinarySerialize, Hash,
|
Serialize, Deserialize, Debug, Copy, Clone, FuzzerObject, ToPrimitiveU32, BinarySerialize, Hash,
|
||||||
)]
|
)]
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
|
#[derive(Default)]
|
||||||
pub enum PacketType {
|
pub enum PacketType {
|
||||||
|
#[default]
|
||||||
Read = 0x0,
|
Read = 0x0,
|
||||||
Write = 0x1,
|
Write = 0x1,
|
||||||
Reset = 0x2,
|
Reset = 0x2,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for PacketType {
|
|
||||||
fn default() -> Self {
|
|
||||||
PacketType::Read
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Input for PacketData {
|
impl Input for PacketData {
|
||||||
fn generate_name(&self, idx: usize) -> String {
|
fn generate_name(&self, idx: usize) -> String {
|
||||||
format!("id_{idx}")
|
format!("id_{idx}")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user