Merge branch 'main' of github.com:AFLplusplus/libAFLrs into main

This commit is contained in:
Andrea Fioraldi 2021-02-11 15:44:31 +01:00
commit 35b7f9364a
2 changed files with 16 additions and 24 deletions

View File

@ -942,14 +942,12 @@ where
// We start ourself as child process to actually fuzz
if std::env::var(_ENV_FUZZER_SENDER).is_err() {
mgr = LlmpEventManager::<I, SH, ST>::new_on_port(stats, broker_port)?;
if mgr.is_broker() {
// Yep, broker. Just loop here.
println!("Doing broker things. Run this tool again to start fuzzing in a client.");
mgr.broker_loop()?;
} else {
mgr.to_env(_ENV_FUZZER_BROKER_CLIENT_INITIAL);
// First, create a channel from the fuzzer (sender) to us (receiver) to report its state for restarts.
@ -975,7 +973,6 @@ where
todo!("Fix this");
}
}
}
}

View File

@ -8,10 +8,10 @@ use clap::{App, Arg};
use std::{env, path::PathBuf};
use afl::{
bolts::{tuples::tuple_list, shmem::AflShmem},
bolts::{shmem::AflShmem, tuples::tuple_list},
corpus::{Corpus, InMemoryCorpus},
events::setup_restarting_mgr,
events::{SimpleStats},
events::SimpleStats,
executors::{inprocess::InProcessExecutor, Executor, ExitKind},
feedbacks::MaxMapFeedback,
inputs::Input,
@ -119,28 +119,24 @@ fn fuzz(input: Option<Vec<PathBuf>>, broker_port: u16) -> Result<(), AflError> {
let mut rand = StdRand::new(0);
// 'While the stats are state, they are usually used in the broker - which is likely never restarted
let stats = SimpleStats::new(|s| println!("{}", s));
// The restarting state will spawn the same process again as child, then restartet it each time it crashes.
let (state_opt, mut restarting_mgr) =
setup_restarting_mgr::<_, _, _, _, AflShmem, _>(stats, broker_port).expect("Failed to setup the restarter".into());
let (state, mut restarting_mgr) =
setup_restarting_mgr::<_, _, _, _, AflShmem, _>(stats, broker_port)
.expect("Failed to setup the restarter".into());
let edges_observer =
StdMapObserver::new_from_ptr(&NAME_COV_MAP, unsafe { __lafl_edges_map }, unsafe {
__lafl_max_edges_size as usize
});
StdMapObserver::new_from_ptr(&NAME_COV_MAP, unsafe { __lafl_edges_map }, unsafe {
__lafl_max_edges_size as usize
});
let mut state = match state_opt {
Some(s) => s,
None => {
State::new(
InMemoryCorpus::new(),
tuple_list!(MaxMapFeedback::new_with_observer(
&NAME_COV_MAP,
&edges_observer
)),
)
},
};
let mut state = state.unwrap_or(State::new(
InMemoryCorpus::new(),
tuple_list!(MaxMapFeedback::new_with_observer(
&NAME_COV_MAP,
&edges_observer
)),
));
println!("We're a client, let's fuzz :)");
@ -149,7 +145,6 @@ fn fuzz(input: Option<Vec<PathBuf>>, broker_port: u16) -> Result<(), AflError> {
let stage = StdMutationalStage::new(mutator);
let mut fuzzer = StdFuzzer::new(tuple_list!(stage));
// Create the executor
let mut executor = InProcessExecutor::new(
"Libfuzzer",