libafl_bolts: rands
super mega ultra giga house cleaning of doom (#2123)
* rands: simpler rand_trait code, remove useless test * rands: provide and use proper random_seed() * rands: add missing golden tests * Don't use current_nanos() for seeding * rands: remove RandomSeed trait
This commit is contained in:
parent
50f14d44fa
commit
b49ab999e3
@ -15,7 +15,7 @@ use libafl::{
|
|||||||
schedulers::QueueScheduler,
|
schedulers::QueueScheduler,
|
||||||
state::StdState,
|
state::StdState,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{current_nanos, rands::StdRand, tuples::tuple_list, AsSlice};
|
use libafl_bolts::{rands::StdRand, tuples::tuple_list, AsSlice};
|
||||||
/* ANCHOR_END: use */
|
/* ANCHOR_END: use */
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
@ -40,7 +40,7 @@ fn main() {
|
|||||||
// create a State from scratch
|
// create a State from scratch
|
||||||
let mut state = StdState::new(
|
let mut state = StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
@ -71,13 +71,7 @@ fn main() {
|
|||||||
|
|
||||||
/* ANCHOR: executor */
|
/* ANCHOR: executor */
|
||||||
// Create the executor for an in-process function
|
// Create the executor for an in-process function
|
||||||
let mut executor = InProcessExecutor::new(
|
let mut executor = InProcessExecutor::new(&mut harness, (), &mut fuzzer, &mut state, &mut mgr)
|
||||||
&mut harness,
|
|
||||||
(),
|
|
||||||
&mut fuzzer,
|
|
||||||
&mut state,
|
|
||||||
&mut mgr,
|
|
||||||
)
|
|
||||||
.expect("Failed to create the Executor");
|
.expect("Failed to create the Executor");
|
||||||
/* ANCHOR_END: executor */
|
/* ANCHOR_END: executor */
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ use libafl::{
|
|||||||
schedulers::QueueScheduler,
|
schedulers::QueueScheduler,
|
||||||
state::StdState,
|
state::StdState,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{current_nanos, rands::StdRand, tuples::tuple_list, AsSlice};
|
use libafl_bolts::{rands::StdRand, tuples::tuple_list, AsSlice};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
/* ANCHOR_END: use */
|
/* ANCHOR_END: use */
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ fn main() {
|
|||||||
// create a State from scratch
|
// create a State from scratch
|
||||||
let mut state = StdState::new(
|
let mut state = StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -17,7 +17,7 @@ use libafl::{
|
|||||||
stages::mutational::StdMutationalStage,
|
stages::mutational::StdMutationalStage,
|
||||||
state::StdState,
|
state::StdState,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{current_nanos, rands::StdRand, tuples::tuple_list, AsSlice};
|
use libafl_bolts::{rands::StdRand, tuples::tuple_list, AsSlice};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
/* ANCHOR_END: use */
|
/* ANCHOR_END: use */
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ fn main() {
|
|||||||
// create a State from scratch
|
// create a State from scratch
|
||||||
let mut state = StdState::new(
|
let mut state = StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -24,7 +24,7 @@ use libafl::{
|
|||||||
stages::mutational::StdMutationalStage,
|
stages::mutational::StdMutationalStage,
|
||||||
state::StdState,
|
state::StdState,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{current_nanos, rands::StdRand, tuples::tuple_list};
|
use libafl_bolts::{rands::StdRand, tuples::tuple_list};
|
||||||
|
|
||||||
/// Coverage map with explicit assignments due to the lack of instrumentation
|
/// Coverage map with explicit assignments due to the lack of instrumentation
|
||||||
static mut SIGNALS: [u8; 16] = [0; 16];
|
static mut SIGNALS: [u8; 16] = [0; 16];
|
||||||
@ -69,7 +69,7 @@ pub fn main() {
|
|||||||
// create a State from scratch
|
// create a State from scratch
|
||||||
let mut state = StdState::new(
|
let mut state = StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -21,7 +21,7 @@ use libafl::{
|
|||||||
state::StdState,
|
state::StdState,
|
||||||
HasMetadata,
|
HasMetadata,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{current_nanos, rands::StdRand, tuples::tuple_list, AsSlice};
|
use libafl_bolts::{rands::StdRand, tuples::tuple_list, AsSlice};
|
||||||
|
|
||||||
/// Coverage map with explicit assignments due to the lack of instrumentation
|
/// Coverage map with explicit assignments due to the lack of instrumentation
|
||||||
static mut SIGNALS: [u8; 16] = [0; 16];
|
static mut SIGNALS: [u8; 16] = [0; 16];
|
||||||
@ -95,7 +95,7 @@ pub fn main() {
|
|||||||
// create a State from scratch
|
// create a State from scratch
|
||||||
let mut state = StdState::new(
|
let mut state = StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -55,7 +55,7 @@ pub fn main() -> Result<(), Error> {
|
|||||||
// create a State from scratch
|
// create a State from scratch
|
||||||
let mut state = StdState::new(
|
let mut state = StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryOnDiskCorpus::new(corpus_dir).unwrap(),
|
InMemoryOnDiskCorpus::new(corpus_dir).unwrap(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
@ -108,7 +108,7 @@ pub fn main() -> Result<(), Error> {
|
|||||||
let minimized_dir = PathBuf::from("./minimized");
|
let minimized_dir = PathBuf::from("./minimized");
|
||||||
|
|
||||||
let mut state = StdState::new(
|
let mut state = StdState::new(
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
InMemoryOnDiskCorpus::new(minimized_dir).unwrap(),
|
InMemoryOnDiskCorpus::new(minimized_dir).unwrap(),
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
&mut (),
|
&mut (),
|
||||||
|
@ -21,7 +21,7 @@ use libafl::{
|
|||||||
state::StdState,
|
state::StdState,
|
||||||
Evaluator,
|
Evaluator,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{current_nanos, rands::StdRand, tuples::tuple_list, AsSlice};
|
use libafl_bolts::{rands::StdRand, tuples::tuple_list, AsSlice};
|
||||||
|
|
||||||
/// Coverage map with explicit assignments due to the lack of instrumentation
|
/// Coverage map with explicit assignments due to the lack of instrumentation
|
||||||
static mut SIGNALS: [u8; 128] = [0; 128];
|
static mut SIGNALS: [u8; 128] = [0; 128];
|
||||||
@ -100,7 +100,7 @@ pub fn main() {
|
|||||||
// create a State from scratch
|
// create a State from scratch
|
||||||
let mut state = StdState::new(
|
let mut state = StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -21,7 +21,7 @@ use libafl::{
|
|||||||
state::StdState,
|
state::StdState,
|
||||||
HasMetadata,
|
HasMetadata,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{current_nanos, rands::StdRand, tuples::tuple_list};
|
use libafl_bolts::{rands::StdRand, tuples::tuple_list};
|
||||||
|
|
||||||
/// Coverage map with explicit assignments due to the lack of instrumentation
|
/// Coverage map with explicit assignments due to the lack of instrumentation
|
||||||
static mut SIGNALS: [u8; 16] = [0; 16];
|
static mut SIGNALS: [u8; 16] = [0; 16];
|
||||||
@ -62,7 +62,7 @@ pub fn main() {
|
|||||||
// create a State from scratch
|
// create a State from scratch
|
||||||
let mut state = StdState::new(
|
let mut state = StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -23,7 +23,7 @@ use libafl::{
|
|||||||
stages::mutational::StdMutationalStage,
|
stages::mutational::StdMutationalStage,
|
||||||
state::{HasSolutions, StdState},
|
state::{HasSolutions, StdState},
|
||||||
};
|
};
|
||||||
use libafl_bolts::{current_nanos, rands::StdRand, tuples::tuple_list, AsSlice};
|
use libafl_bolts::{rands::StdRand, tuples::tuple_list, AsSlice};
|
||||||
use libafl_targets::{edges_max_num, DifferentialAFLMapSwapObserver};
|
use libafl_targets::{edges_max_num, DifferentialAFLMapSwapObserver};
|
||||||
#[cfg(not(miri))]
|
#[cfg(not(miri))]
|
||||||
use mimalloc::MiMalloc;
|
use mimalloc::MiMalloc;
|
||||||
@ -186,7 +186,7 @@ pub fn main() {
|
|||||||
// create a State from scratch
|
// create a State from scratch
|
||||||
let mut state = StdState::new(
|
let mut state = StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -16,7 +16,7 @@ use libafl::{
|
|||||||
stages::mutational::StdMutationalStage,
|
stages::mutational::StdMutationalStage,
|
||||||
state::StdState,
|
state::StdState,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{current_nanos, rands::StdRand, tuples::tuple_list};
|
use libafl_bolts::{rands::StdRand, tuples::tuple_list};
|
||||||
|
|
||||||
/// Coverage map with explicit assignments due to the lack of instrumentation
|
/// Coverage map with explicit assignments due to the lack of instrumentation
|
||||||
static mut SIGNALS: [u8; 16] = [0; 16];
|
static mut SIGNALS: [u8; 16] = [0; 16];
|
||||||
@ -78,7 +78,7 @@ pub fn main() {
|
|||||||
// create a State from scratch
|
// create a State from scratch
|
||||||
let mut state = StdState::new(
|
let mut state = StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -20,7 +20,7 @@ use libafl::{
|
|||||||
state::StdState,
|
state::StdState,
|
||||||
Evaluator,
|
Evaluator,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{current_nanos, rands::StdRand, tuples::tuple_list, AsSlice};
|
use libafl_bolts::{rands::StdRand, tuples::tuple_list, AsSlice};
|
||||||
|
|
||||||
/// Coverage map with explicit assignments due to the lack of instrumentation
|
/// Coverage map with explicit assignments due to the lack of instrumentation
|
||||||
static mut SIGNALS: [u8; 64] = [0; 64];
|
static mut SIGNALS: [u8; 64] = [0; 64];
|
||||||
@ -67,7 +67,7 @@ pub fn main() {
|
|||||||
// create a State from scratch
|
// create a State from scratch
|
||||||
let mut state = StdState::new(
|
let mut state = StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -15,9 +15,7 @@ use libafl::{
|
|||||||
state::{HasSolutions, StdState},
|
state::{HasSolutions, StdState},
|
||||||
Fuzzer, StdFuzzer,
|
Fuzzer, StdFuzzer,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{rands::StdRand, serdeany::RegistryBuilder, tuples::tuple_list, AsSlice};
|
||||||
current_nanos, rands::StdRand, serdeany::RegistryBuilder, tuples::tuple_list, AsSlice,
|
|
||||||
};
|
|
||||||
use wasm_bindgen::prelude::*;
|
use wasm_bindgen::prelude::*;
|
||||||
use web_sys::{Performance, Window};
|
use web_sys::{Performance, Window};
|
||||||
|
|
||||||
@ -89,7 +87,7 @@ pub fn fuzz() {
|
|||||||
// create a State from scratch
|
// create a State from scratch
|
||||||
let mut state = StdState::new(
|
let mut state = StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// In a "real" fuzzing campaign, you should stash solutions in a JS array instead
|
// In a "real" fuzzing campaign, you should stash solutions in a JS array instead
|
||||||
|
@ -18,7 +18,6 @@ use libafl::{
|
|||||||
state::StdState,
|
state::StdState,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
current_nanos,
|
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{unix_shmem, ShMemProvider},
|
shmem::{unix_shmem, ShMemProvider},
|
||||||
tuples::tuple_list,
|
tuples::tuple_list,
|
||||||
@ -76,7 +75,7 @@ pub fn main() {
|
|||||||
// create a State from scratch
|
// create a State from scratch
|
||||||
let mut state = StdState::new(
|
let mut state = StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -25,7 +25,7 @@ use libafl::{
|
|||||||
stages::mutational::StdMutationalStage,
|
stages::mutational::StdMutationalStage,
|
||||||
state::StdState,
|
state::StdState,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{current_nanos, rands::StdRand, tuples::tuple_list, AsSlice};
|
use libafl_bolts::{rands::StdRand, tuples::tuple_list, AsSlice};
|
||||||
#[cfg(any(windows, unix))]
|
#[cfg(any(windows, unix))]
|
||||||
use libc::{abort, printf};
|
use libc::{abort, printf};
|
||||||
use static_alloc::Bump;
|
use static_alloc::Bump;
|
||||||
@ -98,7 +98,7 @@ pub extern "C" fn main(_argc: isize, _argv: *const *const u8) -> isize {
|
|||||||
// create a State from scratch
|
// create a State from scratch
|
||||||
let mut state = StdState::new(
|
let mut state = StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -17,7 +17,6 @@ use libafl::{
|
|||||||
state::StdState,
|
state::StdState,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
current_nanos,
|
|
||||||
ownedref::OwnedRefMut,
|
ownedref::OwnedRefMut,
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{ShMemProvider, StdShMemProvider},
|
shmem::{ShMemProvider, StdShMemProvider},
|
||||||
@ -64,7 +63,7 @@ pub fn main() {
|
|||||||
// create a State from scratch
|
// create a State from scratch
|
||||||
let mut state = StdState::new(
|
let mut state = StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -16,7 +16,7 @@ use libafl::{
|
|||||||
stages::mutational::StdMutationalStage,
|
stages::mutational::StdMutationalStage,
|
||||||
state::StdState,
|
state::StdState,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{current_nanos, rands::StdRand, tuples::tuple_list, AsSlice};
|
use libafl_bolts::{rands::StdRand, tuples::tuple_list, AsSlice};
|
||||||
use libc::c_uchar;
|
use libc::c_uchar;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ pub fn main() {
|
|||||||
// create a State from scratch
|
// create a State from scratch
|
||||||
let mut state = StdState::new(
|
let mut state = StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -25,7 +25,6 @@ use libafl::{
|
|||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
current_nanos,
|
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{unix_shmem, ShMem, ShMemId, ShMemProvider},
|
shmem::{unix_shmem, ShMem, ShMemId, ShMemProvider},
|
||||||
tuples::tuple_list,
|
tuples::tuple_list,
|
||||||
@ -53,7 +52,7 @@ pub fn main() {
|
|||||||
// create a State from scratch
|
// create a State from scratch
|
||||||
let mut state = StdState::new(
|
let mut state = StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -21,7 +21,6 @@ use libafl_bolts::shmem::StdShMemProvider;
|
|||||||
#[cfg(target_vendor = "apple")]
|
#[cfg(target_vendor = "apple")]
|
||||||
use libafl_bolts::shmem::UnixShMemProvider;
|
use libafl_bolts::shmem::UnixShMemProvider;
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
current_nanos,
|
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{ShMem, ShMemProvider},
|
shmem::{ShMem, ShMemProvider},
|
||||||
tuples::tuple_list,
|
tuples::tuple_list,
|
||||||
@ -63,7 +62,7 @@ pub fn main() {
|
|||||||
// create a State from scratch
|
// create a State from scratch
|
||||||
let mut state = StdState::new(
|
let mut state = StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::<BytesInput>::new(),
|
InMemoryCorpus::<BytesInput>::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -19,7 +19,6 @@ use libafl::{
|
|||||||
state::StdState,
|
state::StdState,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
current_nanos,
|
|
||||||
ownedref::OwnedRefMut,
|
ownedref::OwnedRefMut,
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{unix_shmem, ShMem, ShMemProvider},
|
shmem::{unix_shmem, ShMem, ShMemProvider},
|
||||||
@ -83,7 +82,7 @@ pub fn main() {
|
|||||||
// create a State from scratch
|
// create a State from scratch
|
||||||
let mut state = StdState::new(
|
let mut state = StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -18,7 +18,7 @@ use libafl::{
|
|||||||
stages::mutational::StdMutationalStage,
|
stages::mutational::StdMutationalStage,
|
||||||
state::StdState,
|
state::StdState,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{current_nanos, rands::StdRand, tuples::tuple_list, AsSlice};
|
use libafl_bolts::{rands::StdRand, tuples::tuple_list, AsSlice};
|
||||||
|
|
||||||
/// Coverage map with explicit assignments due to the lack of instrumentation
|
/// Coverage map with explicit assignments due to the lack of instrumentation
|
||||||
static mut SIGNALS: [u8; 16] = [0; 16];
|
static mut SIGNALS: [u8; 16] = [0; 16];
|
||||||
@ -75,7 +75,7 @@ pub fn main() {
|
|||||||
// create a State from scratch
|
// create a State from scratch
|
||||||
let mut state = StdState::new(
|
let mut state = StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -19,7 +19,6 @@ use libafl::{
|
|||||||
HasMetadata,
|
HasMetadata,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
current_nanos,
|
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{ShMem, ShMemProvider, UnixShMemProvider},
|
shmem::{ShMem, ShMemProvider, UnixShMemProvider},
|
||||||
tuples::{tuple_list, MatchNameRef, Merge, Referenceable},
|
tuples::{tuple_list, MatchNameRef, Merge, Referenceable},
|
||||||
@ -132,7 +131,7 @@ pub fn main() {
|
|||||||
// create a State from scratch
|
// create a State from scratch
|
||||||
let mut state = StdState::new(
|
let mut state = StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::<BytesInput>::new(),
|
InMemoryCorpus::<BytesInput>::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -26,7 +26,6 @@ use libafl::{
|
|||||||
use libafl::{feedback_and_fast, feedbacks::ConstFeedback};
|
use libafl::{feedback_and_fast, feedbacks::ConstFeedback};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
cli::{parse_args, FuzzerOptions},
|
cli::{parse_args, FuzzerOptions},
|
||||||
current_nanos,
|
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{ShMemProvider, StdShMemProvider},
|
shmem::{ShMemProvider, StdShMemProvider},
|
||||||
tuples::{tuple_list, Merge},
|
tuples::{tuple_list, Merge},
|
||||||
@ -153,7 +152,7 @@ unsafe fn fuzz(
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
CachedOnDiskCorpus::no_meta(PathBuf::from("./corpus_discovered"), 64)
|
CachedOnDiskCorpus::no_meta(PathBuf::from("./corpus_discovered"), 64)
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
@ -271,7 +270,7 @@ unsafe fn fuzz(
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
CachedOnDiskCorpus::no_meta(PathBuf::from("./corpus_discovered"), 64)
|
CachedOnDiskCorpus::no_meta(PathBuf::from("./corpus_discovered"), 64)
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
@ -404,7 +403,7 @@ unsafe fn fuzz(
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
CachedOnDiskCorpus::no_meta(PathBuf::from("./corpus_discovered"), 64)
|
CachedOnDiskCorpus::no_meta(PathBuf::from("./corpus_discovered"), 64)
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
|
@ -36,7 +36,6 @@ use libafl::{
|
|||||||
use libafl::{feedback_and_fast, feedbacks::ConstFeedback};
|
use libafl::{feedback_and_fast, feedbacks::ConstFeedback};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
cli::{parse_args, FuzzerOptions},
|
cli::{parse_args, FuzzerOptions},
|
||||||
current_nanos,
|
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{ShMemProvider, StdShMemProvider},
|
shmem::{ShMemProvider, StdShMemProvider},
|
||||||
tuples::{tuple_list, Merge},
|
tuples::{tuple_list, Merge},
|
||||||
@ -149,7 +148,7 @@ unsafe fn fuzz(options: &FuzzerOptions) -> Result<(), Error> {
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
CachedOnDiskCorpus::new(PathBuf::from("./corpus_discovered"), 64).unwrap(),
|
CachedOnDiskCorpus::new(PathBuf::from("./corpus_discovered"), 64).unwrap(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
@ -266,7 +265,7 @@ unsafe fn fuzz(options: &FuzzerOptions) -> Result<(), Error> {
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
CachedOnDiskCorpus::no_meta(PathBuf::from("./corpus_discovered"), 64)
|
CachedOnDiskCorpus::no_meta(PathBuf::from("./corpus_discovered"), 64)
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
@ -401,7 +400,7 @@ unsafe fn fuzz(options: &FuzzerOptions) -> Result<(), Error> {
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
CachedOnDiskCorpus::no_meta(PathBuf::from("./corpus_discovered"), 64)
|
CachedOnDiskCorpus::no_meta(PathBuf::from("./corpus_discovered"), 64)
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
|
@ -26,7 +26,6 @@ use libafl::{
|
|||||||
use libafl::{feedback_and_fast, feedbacks::ConstFeedback};
|
use libafl::{feedback_and_fast, feedbacks::ConstFeedback};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
cli::{parse_args, FuzzerOptions},
|
cli::{parse_args, FuzzerOptions},
|
||||||
current_nanos,
|
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{ShMemProvider, StdShMemProvider},
|
shmem::{ShMemProvider, StdShMemProvider},
|
||||||
tuples::{tuple_list, Merge},
|
tuples::{tuple_list, Merge},
|
||||||
@ -143,7 +142,7 @@ unsafe fn fuzz(options: &FuzzerOptions) -> Result<(), Error> {
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
CachedOnDiskCorpus::no_meta(PathBuf::from("./corpus_discovered"), 64)
|
CachedOnDiskCorpus::no_meta(PathBuf::from("./corpus_discovered"), 64)
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
@ -262,7 +261,7 @@ unsafe fn fuzz(options: &FuzzerOptions) -> Result<(), Error> {
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
CachedOnDiskCorpus::no_meta(PathBuf::from("./corpus_discovered"), 64)
|
CachedOnDiskCorpus::no_meta(PathBuf::from("./corpus_discovered"), 64)
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
@ -395,7 +394,7 @@ unsafe fn fuzz(options: &FuzzerOptions) -> Result<(), Error> {
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
CachedOnDiskCorpus::no_meta(PathBuf::from("./corpus_discovered"), 64)
|
CachedOnDiskCorpus::no_meta(PathBuf::from("./corpus_discovered"), 64)
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
|
@ -40,7 +40,7 @@ use libafl::{
|
|||||||
Error, HasMetadata,
|
Error, HasMetadata,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
current_nanos, current_time,
|
current_time,
|
||||||
os::dup2,
|
os::dup2,
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{ShMemProvider, StdShMemProvider},
|
shmem::{ShMemProvider, StdShMemProvider},
|
||||||
@ -270,7 +270,7 @@ fn fuzz(
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryOnDiskCorpus::new(corpus_dir).unwrap(),
|
InMemoryOnDiskCorpus::new(corpus_dir).unwrap(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -43,7 +43,7 @@ use libafl::{
|
|||||||
Error, HasMetadata,
|
Error, HasMetadata,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
current_nanos, current_time,
|
current_time,
|
||||||
os::dup2,
|
os::dup2,
|
||||||
ownedref::OwnedMutSlice,
|
ownedref::OwnedMutSlice,
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
@ -280,7 +280,7 @@ fn fuzz(
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryOnDiskCorpus::new(corpus_dir).unwrap(),
|
InMemoryOnDiskCorpus::new(corpus_dir).unwrap(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -38,7 +38,7 @@ use libafl::{
|
|||||||
Error, HasMetadata,
|
Error, HasMetadata,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
current_nanos, current_time,
|
current_time,
|
||||||
os::{dup2, unix_signals::Signal},
|
os::{dup2, unix_signals::Signal},
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{ShMemProvider, StdShMemProvider},
|
shmem::{ShMemProvider, StdShMemProvider},
|
||||||
@ -268,7 +268,7 @@ fn fuzz(
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryOnDiskCorpus::new(corpus_dir).unwrap(),
|
InMemoryOnDiskCorpus::new(corpus_dir).unwrap(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -35,7 +35,7 @@ use libafl::{
|
|||||||
Error, HasMetadata,
|
Error, HasMetadata,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
current_nanos, current_time,
|
current_time,
|
||||||
ownedref::OwnedRefMut,
|
ownedref::OwnedRefMut,
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{ShMem, ShMemProvider, UnixShMemProvider},
|
shmem::{ShMem, ShMemProvider, UnixShMemProvider},
|
||||||
@ -276,7 +276,7 @@ fn fuzz(
|
|||||||
// create a State from scratch
|
// create a State from scratch
|
||||||
let mut state = StdState::new(
|
let mut state = StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryOnDiskCorpus::<BytesInput>::new(corpus_dir).unwrap(),
|
InMemoryOnDiskCorpus::<BytesInput>::new(corpus_dir).unwrap(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -33,7 +33,7 @@ use libafl::{
|
|||||||
Error, HasMetadata,
|
Error, HasMetadata,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
current_nanos, current_time,
|
current_time,
|
||||||
ownedref::OwnedRefMut,
|
ownedref::OwnedRefMut,
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{ShMem, ShMemProvider, UnixShMemProvider},
|
shmem::{ShMem, ShMemProvider, UnixShMemProvider},
|
||||||
@ -277,7 +277,7 @@ fn fuzz(
|
|||||||
// create a State from scratch
|
// create a State from scratch
|
||||||
let mut state = StdState::new(
|
let mut state = StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryOnDiskCorpus::<BytesInput>::new(corpus_dir).unwrap(),
|
InMemoryOnDiskCorpus::<BytesInput>::new(corpus_dir).unwrap(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -37,7 +37,7 @@ use libafl::{
|
|||||||
Error, HasMetadata,
|
Error, HasMetadata,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
current_nanos, current_time,
|
current_time,
|
||||||
os::{dup2, unix_signals::Signal},
|
os::{dup2, unix_signals::Signal},
|
||||||
ownedref::OwnedMutSlice,
|
ownedref::OwnedMutSlice,
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
@ -290,7 +290,7 @@ fn fuzz(
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryOnDiskCorpus::new(corpus_dir).unwrap(),
|
InMemoryOnDiskCorpus::new(corpus_dir).unwrap(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -46,7 +46,7 @@ use libafl::{
|
|||||||
Error, HasMetadata,
|
Error, HasMetadata,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
current_nanos, current_time,
|
current_time,
|
||||||
os::dup2,
|
os::dup2,
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{ShMemProvider, StdShMemProvider},
|
shmem::{ShMemProvider, StdShMemProvider},
|
||||||
@ -337,7 +337,7 @@ fn fuzz_binary(
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryOnDiskCorpus::new(corpus_dir).unwrap(),
|
InMemoryOnDiskCorpus::new(corpus_dir).unwrap(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
@ -549,7 +549,7 @@ fn fuzz_text(
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryOnDiskCorpus::new(corpus_dir).unwrap(),
|
InMemoryOnDiskCorpus::new(corpus_dir).unwrap(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -33,7 +33,6 @@ use libafl::{
|
|||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
core_affinity::Cores,
|
core_affinity::Cores,
|
||||||
current_nanos,
|
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{ShMemProvider, StdShMemProvider},
|
shmem::{ShMemProvider, StdShMemProvider},
|
||||||
tuples::{tuple_list, Merge},
|
tuples::{tuple_list, Merge},
|
||||||
@ -161,7 +160,7 @@ pub extern "C" fn LLVMFuzzerRunDriver(
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -26,7 +26,6 @@ use libafl::{
|
|||||||
Error, HasMetadata,
|
Error, HasMetadata,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
current_nanos,
|
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
tuples::{tuple_list, Merge},
|
tuples::{tuple_list, Merge},
|
||||||
AsSlice,
|
AsSlice,
|
||||||
@ -100,7 +99,7 @@ fn fuzz(corpus_dirs: &[PathBuf], objective_dir: PathBuf, broker_port: u16) -> Re
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -27,7 +27,6 @@ use libafl::{
|
|||||||
Error, HasMetadata,
|
Error, HasMetadata,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
current_nanos,
|
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
tuples::{tuple_list, Merge},
|
tuples::{tuple_list, Merge},
|
||||||
AsSlice,
|
AsSlice,
|
||||||
@ -111,7 +110,7 @@ fn fuzz(corpus_dirs: &[PathBuf], objective_dir: PathBuf, broker_port: u16) -> Re
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -27,7 +27,6 @@ use libafl::{
|
|||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
core_affinity::Cores,
|
core_affinity::Cores,
|
||||||
current_nanos,
|
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{ShMemProvider, StdShMemProvider},
|
shmem::{ShMemProvider, StdShMemProvider},
|
||||||
tuples::{tuple_list, Merge},
|
tuples::{tuple_list, Merge},
|
||||||
@ -163,7 +162,7 @@ pub extern "C" fn libafl_main() {
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -27,7 +27,6 @@ use libafl::{
|
|||||||
Error, HasMetadata,
|
Error, HasMetadata,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
current_nanos,
|
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
tuples::{tuple_list, Merge},
|
tuples::{tuple_list, Merge},
|
||||||
AsSlice,
|
AsSlice,
|
||||||
@ -125,7 +124,7 @@ fn fuzz(
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryOnDiskCorpus::new(corpus_dir).unwrap(),
|
InMemoryOnDiskCorpus::new(corpus_dir).unwrap(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -27,7 +27,6 @@ use libafl::{
|
|||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
core_affinity::{CoreId, Cores},
|
core_affinity::{CoreId, Cores},
|
||||||
current_nanos,
|
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{ShMemProvider, StdShMemProvider},
|
shmem::{ShMemProvider, StdShMemProvider},
|
||||||
tuples::{tuple_list, Merge},
|
tuples::{tuple_list, Merge},
|
||||||
@ -160,7 +159,7 @@ pub extern "C" fn libafl_main() {
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -30,7 +30,6 @@ use libafl::{
|
|||||||
Error, HasMetadata,
|
Error, HasMetadata,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
current_nanos,
|
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
tuples::{tuple_list, Merge},
|
tuples::{tuple_list, Merge},
|
||||||
AsSlice,
|
AsSlice,
|
||||||
@ -110,7 +109,7 @@ fn fuzz(corpus_dirs: &[PathBuf], objective_dir: PathBuf, broker_port: u16) -> Re
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -27,7 +27,6 @@ use libafl::{
|
|||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
core_affinity::Cores,
|
core_affinity::Cores,
|
||||||
current_nanos,
|
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{ShMemProvider, StdShMemProvider},
|
shmem::{ShMemProvider, StdShMemProvider},
|
||||||
tuples::{tuple_list, Merge},
|
tuples::{tuple_list, Merge},
|
||||||
@ -161,7 +160,7 @@ pub extern "C" fn libafl_main() {
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -31,7 +31,6 @@ use libafl::{
|
|||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
core_affinity::Cores,
|
core_affinity::Cores,
|
||||||
current_nanos,
|
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{ShMemProvider, StdShMemProvider},
|
shmem::{ShMemProvider, StdShMemProvider},
|
||||||
tuples::{tuple_list, Merge},
|
tuples::{tuple_list, Merge},
|
||||||
@ -186,7 +185,7 @@ pub extern "C" fn libafl_main() {
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryOnDiskCorpus::new(&opt.input[0]).unwrap(),
|
InMemoryOnDiskCorpus::new(&opt.input[0]).unwrap(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -27,7 +27,6 @@ use libafl::{
|
|||||||
Error, HasMetadata,
|
Error, HasMetadata,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
current_nanos,
|
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
tuples::{tuple_list, Merge},
|
tuples::{tuple_list, Merge},
|
||||||
AsSlice,
|
AsSlice,
|
||||||
@ -109,7 +108,7 @@ fn fuzz(corpus_dirs: &[PathBuf], objective_dir: PathBuf, broker_port: u16) -> Re
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -25,7 +25,7 @@ use libafl::{
|
|||||||
state::{HasCorpus, StdState},
|
state::{HasCorpus, StdState},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{current_nanos, rands::StdRand, tuples::tuple_list, AsSlice};
|
use libafl_bolts::{rands::StdRand, tuples::tuple_list, AsSlice};
|
||||||
use libafl_targets::{
|
use libafl_targets::{
|
||||||
libfuzzer_initialize, libfuzzer_test_one_input, std_edges_map_observer, CmpLogObserver,
|
libfuzzer_initialize, libfuzzer_test_one_input, std_edges_map_observer, CmpLogObserver,
|
||||||
};
|
};
|
||||||
@ -91,7 +91,7 @@ fn fuzz(corpus_dirs: &[PathBuf], objective_dir: PathBuf, broker_port: u16) -> Re
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -20,7 +20,6 @@ use libafl::{
|
|||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
current_nanos,
|
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
tuples::{tuple_list, Merge},
|
tuples::{tuple_list, Merge},
|
||||||
AsSlice,
|
AsSlice,
|
||||||
@ -87,7 +86,7 @@ fn fuzz(corpus_dirs: &[PathBuf], objective_dir: PathBuf, broker_port: u16) -> Re
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -28,7 +28,6 @@ use libafl::{
|
|||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
core_affinity::Cores,
|
core_affinity::Cores,
|
||||||
current_nanos,
|
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{ShMemProvider, StdShMemProvider},
|
shmem::{ShMemProvider, StdShMemProvider},
|
||||||
tuples::tuple_list,
|
tuples::tuple_list,
|
||||||
@ -159,7 +158,7 @@ pub extern "C" fn libafl_main() {
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -15,7 +15,7 @@ use libafl::{
|
|||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
core_affinity::{CoreId, Cores},
|
core_affinity::{CoreId, Cores},
|
||||||
rands::{RandomSeed, StdRand},
|
rands::StdRand,
|
||||||
shmem::{ShMemProvider, StdShMemProvider},
|
shmem::{ShMemProvider, StdShMemProvider},
|
||||||
tuples::tuple_list,
|
tuples::tuple_list,
|
||||||
};
|
};
|
||||||
|
@ -13,10 +13,7 @@ use libafl::{
|
|||||||
state::StdState,
|
state::StdState,
|
||||||
Fuzzer, StdFuzzer,
|
Fuzzer, StdFuzzer,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{rands::StdRand, tuples::tuple_list};
|
||||||
rands::{RandomSeed, StdRand},
|
|
||||||
tuples::tuple_list,
|
|
||||||
};
|
|
||||||
use libafl_nyx::{executor::NyxExecutor, helper::NyxHelper, settings::NyxSettings};
|
use libafl_nyx::{executor::NyxExecutor, helper::NyxHelper, settings::NyxSettings};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
@ -20,7 +20,6 @@ use libafl::{
|
|||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
core_affinity::Cores,
|
core_affinity::Cores,
|
||||||
current_nanos,
|
|
||||||
os::unix_signals::Signal,
|
os::unix_signals::Signal,
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{ShMemProvider, StdShMemProvider},
|
shmem::{ShMemProvider, StdShMemProvider},
|
||||||
@ -176,7 +175,7 @@ pub fn fuzz() -> Result<(), Error> {
|
|||||||
|
|
||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
InMemoryOnDiskCorpus::new(PathBuf::from(options.output)).unwrap(),
|
InMemoryOnDiskCorpus::new(PathBuf::from(options.output)).unwrap(),
|
||||||
NopCorpus::new(),
|
NopCorpus::new(),
|
||||||
&mut feedback,
|
&mut feedback,
|
||||||
|
@ -19,7 +19,6 @@ use libafl::{
|
|||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
core_affinity::Cores,
|
core_affinity::Cores,
|
||||||
current_nanos,
|
|
||||||
os::unix_signals::Signal,
|
os::unix_signals::Signal,
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{ShMemProvider, StdShMemProvider},
|
shmem::{ShMemProvider, StdShMemProvider},
|
||||||
@ -216,7 +215,7 @@ pub fn fuzz() {
|
|||||||
|
|
||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
NopCorpus::new(),
|
NopCorpus::new(),
|
||||||
NopCorpus::new(),
|
NopCorpus::new(),
|
||||||
&mut feedback,
|
&mut feedback,
|
||||||
|
@ -33,7 +33,6 @@ use libafl::{
|
|||||||
use libafl_bolts::shmem::StdShMemProvider;
|
use libafl_bolts::shmem::StdShMemProvider;
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
core_affinity::CoreId,
|
core_affinity::CoreId,
|
||||||
current_nanos,
|
|
||||||
ownedref::OwnedMutSlice,
|
ownedref::OwnedMutSlice,
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
tuples::{tuple_list, Merge},
|
tuples::{tuple_list, Merge},
|
||||||
@ -110,7 +109,7 @@ impl<'a, M: Monitor> Instance<'a, M> {
|
|||||||
None => {
|
None => {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryOnDiskCorpus::no_meta(self.options.queue_dir(self.core_id))?,
|
InMemoryOnDiskCorpus::no_meta(self.options.queue_dir(self.core_id))?,
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -18,10 +18,7 @@ use libafl_bolts::shmem::UnixShMemProvider;
|
|||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
use libafl_bolts::shmem::Win32ShMemProvider;
|
use libafl_bolts::shmem::Win32ShMemProvider;
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
ownedref::OwnedMutPtr,
|
ownedref::OwnedMutPtr, rands::StdRand, shmem::ShMemProvider, tuples::tuple_list,
|
||||||
rands::{RandomSeed, StdRand},
|
|
||||||
shmem::ShMemProvider,
|
|
||||||
tuples::tuple_list,
|
|
||||||
};
|
};
|
||||||
use libafl_tinyinst::executor::TinyInstExecutorBuilder;
|
use libafl_tinyinst::executor::TinyInstExecutorBuilder;
|
||||||
static mut COVERAGE: Vec<u64> = vec![];
|
static mut COVERAGE: Vec<u64> = vec![];
|
||||||
|
@ -21,7 +21,7 @@ use libafl::{
|
|||||||
state::{HasCorpus, StdState},
|
state::{HasCorpus, StdState},
|
||||||
Error, Fuzzer,
|
Error, Fuzzer,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{current_nanos, rands::StdRand, tuples::tuple_list, AsSlice};
|
use libafl_bolts::{rands::StdRand, tuples::tuple_list, AsSlice};
|
||||||
use libafl_targets::{libfuzzer_initialize, libfuzzer_test_one_input, std_edges_map_observer};
|
use libafl_targets::{libfuzzer_initialize, libfuzzer_test_one_input, std_edges_map_observer};
|
||||||
|
|
||||||
mod input;
|
mod input;
|
||||||
@ -108,7 +108,7 @@ fn fuzz(corpus_dirs: &[PathBuf], objective_dir: PathBuf, broker_port: u16) -> Re
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
InMemoryCorpus::new(),
|
InMemoryCorpus::new(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -1,12 +1,52 @@
|
|||||||
//! The random number generators of `LibAFL`
|
//! The random number generators of `LibAFL`
|
||||||
use core::{debug_assert, fmt::Debug};
|
|
||||||
|
|
||||||
#[cfg(feature = "rand_trait")]
|
use core::{
|
||||||
use rand_core::{impls::fill_bytes_via_next, RngCore};
|
debug_assert,
|
||||||
|
fmt::Debug,
|
||||||
|
sync::atomic::{AtomicUsize, Ordering},
|
||||||
|
};
|
||||||
|
|
||||||
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||||
|
|
||||||
|
/// Return a pseudo-random seed. For `no_std` environments, a single deterministic sequence is used.
|
||||||
|
#[must_use]
|
||||||
|
#[allow(unreachable_code)]
|
||||||
|
pub fn random_seed() -> u64 {
|
||||||
|
#[cfg(feature = "std")]
|
||||||
|
return random_seed_from_random_state();
|
||||||
|
#[cfg(all(not(feature = "std"), target_has_atomic = "ptr"))]
|
||||||
|
return random_seed_deterministic();
|
||||||
|
// no_std and no atomics; https://xkcd.com/221/
|
||||||
|
4
|
||||||
|
}
|
||||||
|
|
||||||
|
static SEED_COUNTER: AtomicUsize = AtomicUsize::new(0);
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
|
#[cfg(target_has_atomic = "ptr")]
|
||||||
|
fn random_seed_deterministic() -> u64 {
|
||||||
|
let mut seed = SEED_COUNTER.fetch_add(1, Ordering::Relaxed) as u64;
|
||||||
|
splitmix64(&mut seed)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
use crate::current_nanos;
|
fn random_seed_from_random_state() -> u64 {
|
||||||
|
use std::{
|
||||||
|
collections::hash_map::RandomState,
|
||||||
|
hash::{BuildHasher, Hasher},
|
||||||
|
};
|
||||||
|
RandomState::new().build_hasher().finish()
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://prng.di.unimi.it/splitmix64.c
|
||||||
|
fn splitmix64(x: &mut u64) -> u64 {
|
||||||
|
*x = x.wrapping_add(0x9e3779b97f4a7c15);
|
||||||
|
let mut z = *x;
|
||||||
|
z = (z ^ (z >> 30)).wrapping_mul(0xbf58476d1ce4e5b9);
|
||||||
|
z = (z ^ (z >> 27)).wrapping_mul(0x94d049bb133111eb);
|
||||||
|
z ^ (z >> 31)
|
||||||
|
}
|
||||||
|
|
||||||
/// The standard rand implementation for `LibAFL`.
|
/// The standard rand implementation for `LibAFL`.
|
||||||
/// It is usually the right choice, with very good speed and a reasonable randomness.
|
/// It is usually the right choice, with very good speed and a reasonable randomness.
|
||||||
@ -101,64 +141,36 @@ pub trait Rand: Debug + Serialize + DeserializeOwned {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// helper macro for deriving Default
|
macro_rules! impl_default_new {
|
||||||
macro_rules! default_rand {
|
|
||||||
($rand: ty) => {
|
($rand: ty) => {
|
||||||
/// A default RNG will usually produce a nondeterministic stream of random numbers.
|
|
||||||
/// As we do not have any way to get random seeds for `no_std`, they have to be reproducible there.
|
|
||||||
/// Use [`$rand::with_seed`] to generate a reproducible RNG.
|
|
||||||
impl Default for $rand {
|
impl Default for $rand {
|
||||||
#[cfg(feature = "std")]
|
/// Creates a generator seeded with [`random_seed`].
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::new()
|
Self::with_seed(random_seed())
|
||||||
}
|
}
|
||||||
#[cfg(not(feature = "std"))]
|
}
|
||||||
fn default() -> Self {
|
|
||||||
Self::with_seed(0xAF1)
|
impl $rand {
|
||||||
|
/// Creates a generator seeded with [`random_seed`].
|
||||||
|
#[must_use]
|
||||||
|
pub fn new() -> Self {
|
||||||
|
Self::with_seed(random_seed())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://prng.di.unimi.it/splitmix64.c
|
impl_default_new!(Xoshiro256PlusPlusRand);
|
||||||
fn splitmix64(x: &mut u64) -> u64 {
|
impl_default_new!(XorShift64Rand);
|
||||||
*x = x.wrapping_add(0x9e3779b97f4a7c15);
|
impl_default_new!(Lehmer64Rand);
|
||||||
let mut z = *x;
|
impl_default_new!(RomuTrioRand);
|
||||||
z = (z ^ (z >> 30)).wrapping_mul(0xbf58476d1ce4e5b9);
|
impl_default_new!(RomuDuoJrRand);
|
||||||
z = (z ^ (z >> 27)).wrapping_mul(0x94d049bb133111eb);
|
impl_default_new!(Sfc64Rand);
|
||||||
z ^ (z >> 31)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Derive Default by calling `new(DEFAULT_SEED)` on each of the following Rand types.
|
macro_rules! impl_rng_core {
|
||||||
default_rand!(Xoshiro256PlusPlusRand);
|
|
||||||
default_rand!(XorShift64Rand);
|
|
||||||
default_rand!(Lehmer64Rand);
|
|
||||||
default_rand!(RomuTrioRand);
|
|
||||||
default_rand!(RomuDuoJrRand);
|
|
||||||
default_rand!(Sfc64Rand);
|
|
||||||
|
|
||||||
/// Initialize Rand types from a source of randomness.
|
|
||||||
///
|
|
||||||
/// Default implementations are provided with the "std" feature enabled, using system time in
|
|
||||||
/// nanoseconds as the initial seed.
|
|
||||||
pub trait RandomSeed: Rand + Default {
|
|
||||||
/// Creates a new [`RandomSeed`].
|
|
||||||
fn new() -> Self;
|
|
||||||
}
|
|
||||||
|
|
||||||
// helper macro to impl RandomSeed
|
|
||||||
macro_rules! impl_random {
|
|
||||||
($rand: ty) => {
|
($rand: ty) => {
|
||||||
#[cfg(feature = "std")]
|
|
||||||
impl RandomSeed for $rand {
|
|
||||||
/// Creates a rand instance, pre-seeded with the current time in nanoseconds.
|
|
||||||
fn new() -> Self {
|
|
||||||
Self::with_seed(current_nanos())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "rand_trait")]
|
#[cfg(feature = "rand_trait")]
|
||||||
impl RngCore for $rand {
|
impl rand_core::RngCore for $rand {
|
||||||
fn next_u32(&mut self) -> u32 {
|
fn next_u32(&mut self) -> u32 {
|
||||||
self.next() as u32
|
self.next() as u32
|
||||||
}
|
}
|
||||||
@ -168,7 +180,7 @@ macro_rules! impl_random {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn fill_bytes(&mut self, dest: &mut [u8]) {
|
fn fill_bytes(&mut self, dest: &mut [u8]) {
|
||||||
fill_bytes_via_next(self, dest)
|
rand_core::impls::fill_bytes_via_next(self, dest)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand_core::Error> {
|
fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), rand_core::Error> {
|
||||||
@ -178,12 +190,12 @@ macro_rules! impl_random {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
impl_random!(Xoshiro256PlusPlusRand);
|
impl_rng_core!(Xoshiro256PlusPlusRand);
|
||||||
impl_random!(XorShift64Rand);
|
impl_rng_core!(XorShift64Rand);
|
||||||
impl_random!(Lehmer64Rand);
|
impl_rng_core!(Lehmer64Rand);
|
||||||
impl_random!(RomuTrioRand);
|
impl_rng_core!(RomuTrioRand);
|
||||||
impl_random!(RomuDuoJrRand);
|
impl_rng_core!(RomuDuoJrRand);
|
||||||
impl_random!(Sfc64Rand);
|
impl_rng_core!(Sfc64Rand);
|
||||||
|
|
||||||
/// xoshiro256++ PRNG: <https://prng.di.unimi.it/>
|
/// xoshiro256++ PRNG: <https://prng.di.unimi.it/>
|
||||||
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
|
#[derive(Copy, Clone, Debug, Serialize, Deserialize)]
|
||||||
@ -480,38 +492,75 @@ mod tests {
|
|||||||
test_single_rand(&mut Sfc64Rand::with_seed(0));
|
test_single_rand(&mut Sfc64Rand::with_seed(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_random_seed() {
|
fn test_romutrio_golden() {
|
||||||
use crate::rands::RandomSeed;
|
// https://github.com/ziglang/zig/blob/130fb5cb0fb9039e79450c9db58d6590c5bee3b3/lib/std/Random/RomuTrio.zig#L75-L95
|
||||||
|
let golden: [u64; 10] = [
|
||||||
|
16294208416658607535,
|
||||||
|
13964609475759908645,
|
||||||
|
4703697494102998476,
|
||||||
|
3425221541186733346,
|
||||||
|
2285772463536419399,
|
||||||
|
9454187757529463048,
|
||||||
|
13695907680080547496,
|
||||||
|
8328236714879408626,
|
||||||
|
12323357569716880909,
|
||||||
|
12375466223337721820,
|
||||||
|
];
|
||||||
|
|
||||||
let mut rand_fixed = StdRand::with_seed(0);
|
let mut s = RomuTrioRand::with_seed(0);
|
||||||
let mut rand = StdRand::new();
|
for v in golden {
|
||||||
|
let u = s.next();
|
||||||
// The seed should be reasonably random so these never fail
|
assert_eq!(v, u);
|
||||||
assert_ne!(rand.next(), rand_fixed.next());
|
}
|
||||||
test_single_rand(&mut rand);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg(feature = "rand_trait")]
|
fn test_romuduojr_golden() {
|
||||||
fn test_rgn_core_support() {
|
// https://github.com/eqv/rand_romu/blob/c0379dc3c21ffac8440197e2f8fe95c226c44bfe/src/lib.rs#L65-L79
|
||||||
use rand_core::RngCore;
|
let golden: [u64; 9] = [
|
||||||
|
0x3c91b13ee3913664,
|
||||||
|
0xdc1980b78df3115,
|
||||||
|
0x1c163b704996d2ad,
|
||||||
|
0xa000c594bb28313b,
|
||||||
|
0xfb6c42e69a523526,
|
||||||
|
0x1fcebd6988ab21d8,
|
||||||
|
0x5e0a8abf025f8f02,
|
||||||
|
0x29554b00ffab0263,
|
||||||
|
0xff5b6bb1551cf66,
|
||||||
|
];
|
||||||
|
|
||||||
use crate::rands::StdRand;
|
let mut s = RomuDuoJrRand {
|
||||||
pub struct Mutator<R: RngCore> {
|
x_state: 0x3c91b13ee3913664u64,
|
||||||
rng: R,
|
y_state: 0x863f0e37c2637d1fu64,
|
||||||
}
|
|
||||||
|
|
||||||
let mut mutator = Mutator {
|
|
||||||
rng: StdRand::with_seed(0),
|
|
||||||
};
|
};
|
||||||
|
for v in golden {
|
||||||
log::info!("random value: {}", mutator.rng.next_u32());
|
let u = s.next();
|
||||||
|
assert_eq!(v, u);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_sfc64_golden_zig() {
|
fn test_xoshiro256pp_golden() {
|
||||||
|
// https://github.com/ziglang/zig/blob/130fb5cb0fb9039e79450c9db58d6590c5bee3b3/lib/std/Random/Xoshiro256.zig#L96-L103
|
||||||
|
let golden: [u64; 6] = [
|
||||||
|
0x53175d61490b23df,
|
||||||
|
0x61da6f3dc380d507,
|
||||||
|
0x5c0fdf91ec9a7bfc,
|
||||||
|
0x02eebf8c3bbe5e1a,
|
||||||
|
0x7eca04ebaf4a5eea,
|
||||||
|
0x0543c37757f08d9a,
|
||||||
|
];
|
||||||
|
|
||||||
|
let mut s = Xoshiro256PlusPlusRand::with_seed(0);
|
||||||
|
for v in golden {
|
||||||
|
let u = s.next();
|
||||||
|
assert_eq!(v, u);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_sfc64_golden() {
|
||||||
// https://github.com/ziglang/zig/blob/130fb5cb0fb9039e79450c9db58d6590c5bee3b3/lib/std/Random/Sfc64.zig#L73-L99
|
// https://github.com/ziglang/zig/blob/130fb5cb0fb9039e79450c9db58d6590c5bee3b3/lib/std/Random/Sfc64.zig#L73-L99
|
||||||
let golden: [u64; 16] = [
|
let golden: [u64; 16] = [
|
||||||
0x3acfa029e3cc6041,
|
0x3acfa029e3cc6041,
|
||||||
@ -548,8 +597,7 @@ pub mod pybind {
|
|||||||
use pyo3::prelude::*;
|
use pyo3::prelude::*;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
use super::Rand;
|
use super::{random_seed, Rand, StdRand};
|
||||||
use crate::{current_nanos, rands::StdRand};
|
|
||||||
|
|
||||||
#[pyclass(unsendable, name = "StdRand")]
|
#[pyclass(unsendable, name = "StdRand")]
|
||||||
#[allow(clippy::unsafe_derive_deserialize)]
|
#[allow(clippy::unsafe_derive_deserialize)]
|
||||||
@ -563,9 +611,9 @@ pub mod pybind {
|
|||||||
#[pymethods]
|
#[pymethods]
|
||||||
impl PythonStdRand {
|
impl PythonStdRand {
|
||||||
#[staticmethod]
|
#[staticmethod]
|
||||||
fn with_current_nanos() -> Self {
|
fn with_random_seed() -> Self {
|
||||||
Self {
|
Self {
|
||||||
inner: StdRand::with_seed(current_nanos()),
|
inner: StdRand::with_seed(random_seed()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -593,7 +593,7 @@ pub mod unix_shmem {
|
|||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
rands::{Rand, RandomSeed, StdRand},
|
rands::{Rand, StdRand},
|
||||||
shmem::{ShMem, ShMemId, ShMemProvider},
|
shmem::{ShMem, ShMemId, ShMemProvider},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
@ -150,7 +150,6 @@ impl CustomMutationStatus {
|
|||||||
macro_rules! fuzz_with {
|
macro_rules! fuzz_with {
|
||||||
($options:ident, $harness:ident, $operation:expr, $and_then:expr, $edge_maker:expr) => {{
|
($options:ident, $harness:ident, $operation:expr, $and_then:expr, $edge_maker:expr) => {{
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
current_nanos,
|
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
tuples::{Merge, tuple_list},
|
tuples::{Merge, tuple_list},
|
||||||
AsSlice,
|
AsSlice,
|
||||||
@ -282,7 +281,7 @@ macro_rules! fuzz_with {
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep it in memory for performance
|
// Corpus that will be evolved, we keep it in memory for performance
|
||||||
LibfuzzerCorpus::new(corpus_dir.clone(), 4096),
|
LibfuzzerCorpus::new(corpus_dir.clone(), 4096),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -22,7 +22,7 @@ use libafl::{
|
|||||||
Error, HasScheduler, StdFuzzer,
|
Error, HasScheduler, StdFuzzer,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
rands::{Rand, RandomSeed, StdRand},
|
rands::{Rand, StdRand},
|
||||||
shmem::{ShMemProvider, StdShMemProvider},
|
shmem::{ShMemProvider, StdShMemProvider},
|
||||||
tuples::tuple_list,
|
tuples::tuple_list,
|
||||||
AsSlice,
|
AsSlice,
|
||||||
|
@ -16,7 +16,7 @@ use libafl::{
|
|||||||
Error, Fuzzer, StdFuzzer,
|
Error, Fuzzer, StdFuzzer,
|
||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
rands::{RandomSeed, RomuDuoJrRand, StdRand},
|
rands::{RomuDuoJrRand, StdRand},
|
||||||
shmem::{ShMemProvider, StdShMemProvider},
|
shmem::{ShMemProvider, StdShMemProvider},
|
||||||
tuples::tuple_list,
|
tuples::tuple_list,
|
||||||
AsSlice, HasLen,
|
AsSlice, HasLen,
|
||||||
|
@ -23,7 +23,6 @@ use libafl::{
|
|||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
core_affinity::Cores,
|
core_affinity::Cores,
|
||||||
current_nanos,
|
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{ShMem, ShMemProvider, UnixShMemProvider},
|
shmem::{ShMem, ShMemProvider, UnixShMemProvider},
|
||||||
tuples::{tuple_list, Merge, Referenceable},
|
tuples::{tuple_list, Merge, Referenceable},
|
||||||
@ -153,7 +152,7 @@ impl<'a> ForkserverBytesCoverageSugar<'a> {
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep a part in memory for performance
|
// Corpus that will be evolved, we keep a part in memory for performance
|
||||||
CachedOnDiskCorpus::new(out_dir.clone(), CORPUS_CACHE_SIZE).unwrap(),
|
CachedOnDiskCorpus::new(out_dir.clone(), CORPUS_CACHE_SIZE).unwrap(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -26,7 +26,6 @@ use libafl::{
|
|||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
core_affinity::Cores,
|
core_affinity::Cores,
|
||||||
current_nanos,
|
|
||||||
ownedref::OwnedMutSlice,
|
ownedref::OwnedMutSlice,
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{ShMemProvider, StdShMemProvider},
|
shmem::{ShMemProvider, StdShMemProvider},
|
||||||
@ -178,7 +177,7 @@ where
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep a part in memory for performance
|
// Corpus that will be evolved, we keep a part in memory for performance
|
||||||
CachedOnDiskCorpus::new(out_dir.clone(), CORPUS_CACHE_SIZE).unwrap(),
|
CachedOnDiskCorpus::new(out_dir.clone(), CORPUS_CACHE_SIZE).unwrap(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
@ -29,7 +29,6 @@ use libafl::{
|
|||||||
};
|
};
|
||||||
use libafl_bolts::{
|
use libafl_bolts::{
|
||||||
core_affinity::Cores,
|
core_affinity::Cores,
|
||||||
current_nanos,
|
|
||||||
ownedref::OwnedMutSlice,
|
ownedref::OwnedMutSlice,
|
||||||
rands::StdRand,
|
rands::StdRand,
|
||||||
shmem::{ShMemProvider, StdShMemProvider},
|
shmem::{ShMemProvider, StdShMemProvider},
|
||||||
@ -188,7 +187,7 @@ where
|
|||||||
let mut state = state.unwrap_or_else(|| {
|
let mut state = state.unwrap_or_else(|| {
|
||||||
StdState::new(
|
StdState::new(
|
||||||
// RNG
|
// RNG
|
||||||
StdRand::with_seed(current_nanos()),
|
StdRand::new(),
|
||||||
// Corpus that will be evolved, we keep a part in memory for performance
|
// Corpus that will be evolved, we keep a part in memory for performance
|
||||||
CachedOnDiskCorpus::new(out_dir.clone(), CORPUS_CACHE_SIZE).unwrap(),
|
CachedOnDiskCorpus::new(out_dir.clone(), CORPUS_CACHE_SIZE).unwrap(),
|
||||||
// Corpus in which we store solutions (crashes in this example),
|
// Corpus in which we store solutions (crashes in this example),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user