Renamed Stats to Monitors (#373)
* renamed stats to monitors * added depreciation notices * resorted generics alphaabetically * added monitors * fmt fuzzers * added depreciation note for usermonitor * fmt all fuzzers script * more fmt * renamed some monitor things back to stats * fixed rename
This commit is contained in:
parent
9ab8663366
commit
62afed61e2
2
TODO.md
2
TODO.md
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
- [ ] Objective-Specific Corpuses (named per objective)
|
- [ ] Objective-Specific Corpuses (named per objective)
|
||||||
- [ ] Good documentation
|
- [ ] Good documentation
|
||||||
- [ ] More informative outpus, deeper introspection (stats, what mutation did x, etc.)
|
- [ ] More informative outpus, deeper introspection (monitor, what mutation did x, etc.)
|
||||||
- [ ] Timeout handling for llmp clients (no ping for n seconds -> treat as disconnected)
|
- [ ] Timeout handling for llmp clients (no ping for n seconds -> treat as disconnected)
|
||||||
- [ ] Heap for signal handling (bumpallo or llmp directly?)
|
- [ ] Heap for signal handling (bumpallo or llmp directly?)
|
||||||
- [x] Frida support for Windows
|
- [x] Frida support for Windows
|
||||||
|
@ -121,15 +121,15 @@ As the second parameter, it takes an instance of something implementing the Corp
|
|||||||
|
|
||||||
We will discuss the last parameter later. The third parameter is another corpus, in this case, to store the testcases that are considered as "solutions" for the fuzzer. For our purpose, the solution is the input that triggers the panic. In this case, we want to store it to disk under the `crashes` directory, so we can inspect it.
|
We will discuss the last parameter later. The third parameter is another corpus, in this case, to store the testcases that are considered as "solutions" for the fuzzer. For our purpose, the solution is the input that triggers the panic. In this case, we want to store it to disk under the `crashes` directory, so we can inspect it.
|
||||||
|
|
||||||
Another required component is the EventManager. It handles some events such as the addition of a testcase to the corpus during the fuzzing process. For our purpose, we use the simplest one that just displays the information about these events to the user using a Stats instance.
|
Another required component is the EventManager. It handles some events such as the addition of a testcase to the corpus during the fuzzing process. For our purpose, we use the simplest one that just displays the information about these events to the user using a `Monitor` instance.
|
||||||
|
|
||||||
```rust,ignore
|
```rust,ignore
|
||||||
// The Stats trait define how the fuzzer stats are reported to the user
|
// The Monitor trait defines how the fuzzer stats are displayed to the user
|
||||||
let stats = SimpleStats::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
|
||||||
let mut mgr = SimpleEventManager::new(stats);
|
let mut mgr = SimpleEventManager::new(mon);
|
||||||
```
|
```
|
||||||
|
|
||||||
In addition, we have the Fuzzer, an entity that contains some actions that alter the State. One of these actions is the scheduling of the testcases to the fuzzer using a CorpusScheduler.
|
In addition, we have the Fuzzer, an entity that contains some actions that alter the State. One of these actions is the scheduling of the testcases to the fuzzer using a CorpusScheduler.
|
||||||
@ -190,8 +190,8 @@ use libafl::{
|
|||||||
fuzzer::StdFuzzer,
|
fuzzer::StdFuzzer,
|
||||||
generators::RandPrintablesGenerator,
|
generators::RandPrintablesGenerator,
|
||||||
inputs::{BytesInput, HasTargetBytes},
|
inputs::{BytesInput, HasTargetBytes},
|
||||||
|
monitors::SimpleMonitor,
|
||||||
state::StdState,
|
state::StdState,
|
||||||
stats::SimpleStats,
|
|
||||||
};
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ An example may look like this:
|
|||||||
Launcher::builder()
|
Launcher::builder()
|
||||||
.configuration(EventConfig::from_name(&configuration))
|
.configuration(EventConfig::from_name(&configuration))
|
||||||
.shmem_provider(shmem_provider)
|
.shmem_provider(shmem_provider)
|
||||||
.stats(stats)
|
.monitor(mon)
|
||||||
.run_client(&mut run_client)
|
.run_client(&mut run_client)
|
||||||
.cores(cores)
|
.cores(cores)
|
||||||
.broker_port(broker_port)
|
.broker_port(broker_port)
|
||||||
|
@ -12,11 +12,11 @@ use libafl::{
|
|||||||
fuzzer::{Fuzzer, StdFuzzer},
|
fuzzer::{Fuzzer, StdFuzzer},
|
||||||
generators::RandPrintablesGenerator,
|
generators::RandPrintablesGenerator,
|
||||||
inputs::{BytesInput, HasTargetBytes},
|
inputs::{BytesInput, HasTargetBytes},
|
||||||
|
monitors::SimpleMonitor,
|
||||||
mutators::scheduled::{havoc_mutations, StdScheduledMutator},
|
mutators::scheduled::{havoc_mutations, StdScheduledMutator},
|
||||||
observers::StdMapObserver,
|
observers::StdMapObserver,
|
||||||
stages::mutational::StdMutationalStage,
|
stages::mutational::StdMutationalStage,
|
||||||
state::StdState,
|
state::StdState,
|
||||||
stats::SimpleStats,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Coverage map with explicit assignments due to the lack of instrumentation
|
/// Coverage map with explicit assignments due to the lack of instrumentation
|
||||||
@ -82,12 +82,12 @@ pub fn main() {
|
|||||||
tuple_list!(feedback_state),
|
tuple_list!(feedback_state),
|
||||||
);
|
);
|
||||||
|
|
||||||
// The Stats trait define how the fuzzer stats are reported to the user
|
// The Monitor trait define how the fuzzer stats are displayed to the user
|
||||||
let stats = SimpleStats::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
|
||||||
let mut mgr = SimpleEventManager::new(stats);
|
let mut mgr = SimpleEventManager::new(mon);
|
||||||
|
|
||||||
// A queue policy to get testcasess from the corpus
|
// A queue policy to get testcasess from the corpus
|
||||||
let scheduler = QueueCorpusScheduler::new();
|
let scheduler = QueueCorpusScheduler::new();
|
||||||
|
@ -17,6 +17,7 @@ use libafl::{
|
|||||||
fuzzer::{Fuzzer, StdFuzzer},
|
fuzzer::{Fuzzer, StdFuzzer},
|
||||||
generators::{Automaton, GramatronGenerator},
|
generators::{Automaton, GramatronGenerator},
|
||||||
inputs::GramatronInput,
|
inputs::GramatronInput,
|
||||||
|
monitors::SimpleMonitor,
|
||||||
mutators::{
|
mutators::{
|
||||||
GramatronRandomMutator, GramatronRecursionMutator, GramatronSpliceMutator,
|
GramatronRandomMutator, GramatronRecursionMutator, GramatronSpliceMutator,
|
||||||
StdScheduledMutator,
|
StdScheduledMutator,
|
||||||
@ -24,7 +25,6 @@ use libafl::{
|
|||||||
observers::StdMapObserver,
|
observers::StdMapObserver,
|
||||||
stages::mutational::StdMutationalStage,
|
stages::mutational::StdMutationalStage,
|
||||||
state::StdState,
|
state::StdState,
|
||||||
stats::SimpleStats,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Coverage map with explicit assignments due to the lack of instrumentation
|
/// Coverage map with explicit assignments due to the lack of instrumentation
|
||||||
@ -83,12 +83,12 @@ pub fn main() {
|
|||||||
tuple_list!(feedback_state),
|
tuple_list!(feedback_state),
|
||||||
);
|
);
|
||||||
|
|
||||||
// The Stats 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 stats = SimpleStats::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
|
||||||
let mut mgr = SimpleEventManager::new(stats);
|
let mut mgr = SimpleEventManager::new(monitor);
|
||||||
|
|
||||||
// A queue policy to get testcasess from the corpus
|
// A queue policy to get testcasess from the corpus
|
||||||
let scheduler = QueueCorpusScheduler::new();
|
let scheduler = QueueCorpusScheduler::new();
|
||||||
|
@ -15,13 +15,13 @@ use libafl::{
|
|||||||
fuzzer::{Fuzzer, StdFuzzer},
|
fuzzer::{Fuzzer, StdFuzzer},
|
||||||
generators::{NautilusContext, NautilusGenerator},
|
generators::{NautilusContext, NautilusGenerator},
|
||||||
inputs::NautilusInput,
|
inputs::NautilusInput,
|
||||||
|
monitors::SimpleMonitor,
|
||||||
mutators::{
|
mutators::{
|
||||||
NautilusRandomMutator, NautilusRecursionMutator, NautilusSpliceMutator, StdScheduledMutator,
|
NautilusRandomMutator, NautilusRecursionMutator, NautilusSpliceMutator, StdScheduledMutator,
|
||||||
},
|
},
|
||||||
observers::StdMapObserver,
|
observers::StdMapObserver,
|
||||||
stages::mutational::StdMutationalStage,
|
stages::mutational::StdMutationalStage,
|
||||||
state::{HasMetadata, StdState},
|
state::{HasMetadata, StdState},
|
||||||
stats::SimpleStats,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Coverage map with explicit assignments due to the lack of instrumentation
|
/// Coverage map with explicit assignments due to the lack of instrumentation
|
||||||
@ -80,12 +80,12 @@ pub fn main() {
|
|||||||
state.add_metadata(NautilusChunksMetadata::new("/tmp/".into()));
|
state.add_metadata(NautilusChunksMetadata::new("/tmp/".into()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// The Stats 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 stats = SimpleStats::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
|
||||||
let mut mgr = SimpleEventManager::new(stats);
|
let mut mgr = SimpleEventManager::new(monitor);
|
||||||
|
|
||||||
// A queue policy to get testcasess from the corpus
|
// A queue policy to get testcasess from the corpus
|
||||||
let scheduler = QueueCorpusScheduler::new();
|
let scheduler = QueueCorpusScheduler::new();
|
||||||
|
@ -12,11 +12,11 @@ use libafl::{
|
|||||||
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback},
|
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback},
|
||||||
fuzzer::{Evaluator, Fuzzer, StdFuzzer},
|
fuzzer::{Evaluator, Fuzzer, StdFuzzer},
|
||||||
inputs::{EncodedInput, InputDecoder, InputEncoder, NaiveTokenizer, TokenInputEncoderDecoder},
|
inputs::{EncodedInput, InputDecoder, InputEncoder, NaiveTokenizer, TokenInputEncoderDecoder},
|
||||||
|
monitors::SimpleMonitor,
|
||||||
mutators::{encoded_mutations::encoded_mutations, scheduled::StdScheduledMutator},
|
mutators::{encoded_mutations::encoded_mutations, scheduled::StdScheduledMutator},
|
||||||
observers::StdMapObserver,
|
observers::StdMapObserver,
|
||||||
stages::mutational::StdMutationalStage,
|
stages::mutational::StdMutationalStage,
|
||||||
state::StdState,
|
state::StdState,
|
||||||
stats::SimpleStats,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Coverage map with explicit assignments due to the lack of instrumentation
|
/// Coverage map with explicit assignments due to the lack of instrumentation
|
||||||
@ -91,12 +91,12 @@ pub fn main() {
|
|||||||
tuple_list!(feedback_state),
|
tuple_list!(feedback_state),
|
||||||
);
|
);
|
||||||
|
|
||||||
// The Stats 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 stats = SimpleStats::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
|
||||||
let mut mgr = SimpleEventManager::new(stats);
|
let mut mgr = SimpleEventManager::new(monitor);
|
||||||
|
|
||||||
// A queue policy to get testcasess from the corpus
|
// A queue policy to get testcasess from the corpus
|
||||||
let scheduler = QueueCorpusScheduler::new();
|
let scheduler = QueueCorpusScheduler::new();
|
||||||
|
@ -13,11 +13,11 @@ use libafl::{
|
|||||||
fuzzer::{Fuzzer, StdFuzzer},
|
fuzzer::{Fuzzer, StdFuzzer},
|
||||||
generators::RandPrintablesGenerator,
|
generators::RandPrintablesGenerator,
|
||||||
inputs::{BytesInput, HasTargetBytes},
|
inputs::{BytesInput, HasTargetBytes},
|
||||||
|
monitors::SimpleMonitor,
|
||||||
mutators::scheduled::{havoc_mutations, StdScheduledMutator},
|
mutators::scheduled::{havoc_mutations, StdScheduledMutator},
|
||||||
observers::StdMapObserver,
|
observers::StdMapObserver,
|
||||||
stages::mutational::StdMutationalStage,
|
stages::mutational::StdMutationalStage,
|
||||||
state::StdState,
|
state::StdState,
|
||||||
stats::SimpleStats,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(any(windows, unix))]
|
#[cfg(any(windows, unix))]
|
||||||
@ -99,8 +99,8 @@ pub fn main() {
|
|||||||
tuple_list!(feedback_state),
|
tuple_list!(feedback_state),
|
||||||
);
|
);
|
||||||
|
|
||||||
// The Stats 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 stats = SimpleStats::new(|s| {
|
let monitor = SimpleMonitor::new(|s| {
|
||||||
// TODO: Print `s` here, if your target permits it.
|
// TODO: Print `s` here, if your target permits it.
|
||||||
#[cfg(any(windows, unix))]
|
#[cfg(any(windows, unix))]
|
||||||
unsafe {
|
unsafe {
|
||||||
@ -113,7 +113,7 @@ pub fn main() {
|
|||||||
|
|
||||||
// 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
|
||||||
let mut mgr = SimpleEventManager::new(stats);
|
let mut mgr = SimpleEventManager::new(monitor);
|
||||||
|
|
||||||
// A queue policy to get testcasess from the corpus
|
// A queue policy to get testcasess from the corpus
|
||||||
let scheduler = QueueCorpusScheduler::new();
|
let scheduler = QueueCorpusScheduler::new();
|
||||||
|
@ -16,11 +16,11 @@ use libafl::{
|
|||||||
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback, TimeFeedback},
|
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback, TimeFeedback},
|
||||||
fuzzer::{Fuzzer, StdFuzzer},
|
fuzzer::{Fuzzer, StdFuzzer},
|
||||||
inputs::BytesInput,
|
inputs::BytesInput,
|
||||||
|
monitors::SimpleMonitor,
|
||||||
mutators::scheduled::{havoc_mutations, StdScheduledMutator},
|
mutators::scheduled::{havoc_mutations, StdScheduledMutator},
|
||||||
observers::{ConstMapObserver, HitcountsMapObserver, TimeObserver},
|
observers::{ConstMapObserver, HitcountsMapObserver, TimeObserver},
|
||||||
stages::mutational::StdMutationalStage,
|
stages::mutational::StdMutationalStage,
|
||||||
state::{HasCorpus, StdState},
|
state::{HasCorpus, StdState},
|
||||||
stats::SimpleStats,
|
|
||||||
};
|
};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
@ -83,12 +83,12 @@ pub fn main() {
|
|||||||
tuple_list!(feedback_state, objective_state),
|
tuple_list!(feedback_state, objective_state),
|
||||||
);
|
);
|
||||||
|
|
||||||
// The Stats 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 stats = SimpleStats::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
|
||||||
let mut mgr = SimpleEventManager::new(stats);
|
let mut mgr = SimpleEventManager::new(monitor);
|
||||||
|
|
||||||
// A minimization+queue policy to get testcasess from the corpus
|
// A minimization+queue policy to get testcasess from the corpus
|
||||||
let scheduler = IndexesLenTimeMinimizerCorpusScheduler::new(QueueCorpusScheduler::new());
|
let scheduler = IndexesLenTimeMinimizerCorpusScheduler::new(QueueCorpusScheduler::new());
|
||||||
|
@ -25,6 +25,7 @@ use libafl::{
|
|||||||
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback, TimeFeedback, TimeoutFeedback},
|
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback, TimeFeedback, TimeoutFeedback},
|
||||||
fuzzer::{Fuzzer, StdFuzzer},
|
fuzzer::{Fuzzer, StdFuzzer},
|
||||||
inputs::{BytesInput, HasTargetBytes, Input},
|
inputs::{BytesInput, HasTargetBytes, Input},
|
||||||
|
monitors::MultiMonitor,
|
||||||
mutators::{
|
mutators::{
|
||||||
scheduled::{havoc_mutations, tokens_mutations, StdScheduledMutator},
|
scheduled::{havoc_mutations, tokens_mutations, StdScheduledMutator},
|
||||||
token_mutations::I2SRandReplace,
|
token_mutations::I2SRandReplace,
|
||||||
@ -33,7 +34,6 @@ use libafl::{
|
|||||||
observers::{HitcountsMapObserver, ObserversTuple, StdMapObserver, TimeObserver},
|
observers::{HitcountsMapObserver, ObserversTuple, StdMapObserver, TimeObserver},
|
||||||
stages::{ShadowTracingStage, StdMutationalStage},
|
stages::{ShadowTracingStage, StdMutationalStage},
|
||||||
state::{HasCorpus, HasMetadata, StdState},
|
state::{HasCorpus, HasMetadata, StdState},
|
||||||
stats::MultiStats,
|
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -277,7 +277,7 @@ unsafe fn fuzz(
|
|||||||
configuration: String,
|
configuration: String,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
// '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 stats = MultiStats::new(|s| println!("{}", s));
|
let monitor = MultiMonitor::new(|s| println!("{}", s));
|
||||||
|
|
||||||
let shmem_provider = StdShMemProvider::new()?;
|
let shmem_provider = StdShMemProvider::new()?;
|
||||||
|
|
||||||
@ -458,7 +458,7 @@ unsafe fn fuzz(
|
|||||||
Launcher::builder()
|
Launcher::builder()
|
||||||
.configuration(EventConfig::from_name(&configuration))
|
.configuration(EventConfig::from_name(&configuration))
|
||||||
.shmem_provider(shmem_provider)
|
.shmem_provider(shmem_provider)
|
||||||
.stats(stats)
|
.monitor(monitor)
|
||||||
.run_client(&mut run_client)
|
.run_client(&mut run_client)
|
||||||
.cores(cores)
|
.cores(cores)
|
||||||
.broker_port(broker_port)
|
.broker_port(broker_port)
|
||||||
|
@ -29,6 +29,7 @@ use libafl::{
|
|||||||
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback, TimeFeedback},
|
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback, TimeFeedback},
|
||||||
fuzzer::{Fuzzer, StdFuzzer},
|
fuzzer::{Fuzzer, StdFuzzer},
|
||||||
inputs::{BytesInput, HasTargetBytes},
|
inputs::{BytesInput, HasTargetBytes},
|
||||||
|
monitors::SimpleMonitor,
|
||||||
mutators::{
|
mutators::{
|
||||||
scheduled::{havoc_mutations, StdScheduledMutator},
|
scheduled::{havoc_mutations, StdScheduledMutator},
|
||||||
token_mutations::I2SRandReplace,
|
token_mutations::I2SRandReplace,
|
||||||
@ -37,7 +38,6 @@ use libafl::{
|
|||||||
observers::{StdMapObserver, TimeObserver},
|
observers::{StdMapObserver, TimeObserver},
|
||||||
stages::{StdMutationalStage, TracingStage},
|
stages::{StdMutationalStage, TracingStage},
|
||||||
state::{HasCorpus, HasMetadata, StdState},
|
state::{HasCorpus, HasMetadata, StdState},
|
||||||
stats::SimpleStats,
|
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
use libafl_targets::{
|
use libafl_targets::{
|
||||||
@ -171,7 +171,7 @@ fn fuzz(
|
|||||||
let file_null = File::open("/dev/null")?;
|
let file_null = File::open("/dev/null")?;
|
||||||
|
|
||||||
// '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 stats = SimpleStats::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)]
|
||||||
@ -183,7 +183,8 @@ fn fuzz(
|
|||||||
// This way, we are able to continue fuzzing afterwards.
|
// This way, we are able to continue fuzzing afterwards.
|
||||||
let mut shmem_provider = StdShMemProvider::new()?;
|
let mut shmem_provider = StdShMemProvider::new()?;
|
||||||
|
|
||||||
let (state, mut mgr) = match SimpleRestartingEventManager::launch(stats, &mut shmem_provider) {
|
let (state, mut mgr) = match SimpleRestartingEventManager::launch(monitor, &mut shmem_provider)
|
||||||
|
{
|
||||||
// The restarting state will spawn the same process again as child, then restarted it each time it crashes.
|
// The restarting state will spawn the same process again as child, then restarted it each time it crashes.
|
||||||
Ok(res) => res,
|
Ok(res) => res,
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
|
@ -31,6 +31,7 @@ use libafl::{
|
|||||||
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback, TimeFeedback},
|
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback, TimeFeedback},
|
||||||
fuzzer::{Fuzzer, StdFuzzer},
|
fuzzer::{Fuzzer, StdFuzzer},
|
||||||
inputs::{BytesInput, HasTargetBytes},
|
inputs::{BytesInput, HasTargetBytes},
|
||||||
|
monitors::SimpleMonitor,
|
||||||
mutators::{
|
mutators::{
|
||||||
scheduled::havoc_mutations, token_mutations::I2SRandReplace, tokens_mutations,
|
scheduled::havoc_mutations, token_mutations::I2SRandReplace, tokens_mutations,
|
||||||
StdMOptMutator, Tokens,
|
StdMOptMutator, Tokens,
|
||||||
@ -42,7 +43,6 @@ use libafl::{
|
|||||||
TracingStage,
|
TracingStage,
|
||||||
},
|
},
|
||||||
state::{HasCorpus, HasMetadata, StdState},
|
state::{HasCorpus, HasMetadata, StdState},
|
||||||
stats::SimpleStats,
|
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
use libafl_targets::{
|
use libafl_targets::{
|
||||||
@ -175,8 +175,8 @@ fn fuzz(
|
|||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
let file_null = File::open("/dev/null")?;
|
let file_null = File::open("/dev/null")?;
|
||||||
|
|
||||||
// 'While the stats 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 stats = SimpleStats::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)]
|
||||||
@ -188,7 +188,8 @@ fn fuzz(
|
|||||||
// This way, we are able to continue fuzzing afterwards.
|
// This way, we are able to continue fuzzing afterwards.
|
||||||
let mut shmem_provider = StdShMemProvider::new()?;
|
let mut shmem_provider = StdShMemProvider::new()?;
|
||||||
|
|
||||||
let (state, mut mgr) = match SimpleRestartingEventManager::launch(stats, &mut shmem_provider) {
|
let (state, mut mgr) = match SimpleRestartingEventManager::launch(monitor, &mut shmem_provider)
|
||||||
|
{
|
||||||
// The restarting state will spawn the same process again as child, then restarted it each time it crashes.
|
// The restarting state will spawn the same process again as child, then restarted it each time it crashes.
|
||||||
Ok(res) => res,
|
Ok(res) => res,
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
|
@ -29,6 +29,7 @@ use libafl::{
|
|||||||
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback, TimeFeedback, TimeoutFeedback},
|
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback, TimeFeedback, TimeoutFeedback},
|
||||||
fuzzer::{Fuzzer, StdFuzzer},
|
fuzzer::{Fuzzer, StdFuzzer},
|
||||||
inputs::{BytesInput, HasTargetBytes},
|
inputs::{BytesInput, HasTargetBytes},
|
||||||
|
monitors::SimpleMonitor,
|
||||||
mutators::{
|
mutators::{
|
||||||
scheduled::{havoc_mutations, StdScheduledMutator},
|
scheduled::{havoc_mutations, StdScheduledMutator},
|
||||||
tokens_mutations, I2SRandReplace, Tokens,
|
tokens_mutations, I2SRandReplace, Tokens,
|
||||||
@ -36,7 +37,6 @@ use libafl::{
|
|||||||
observers::{HitcountsMapObserver, TimeObserver, VariableMapObserver},
|
observers::{HitcountsMapObserver, TimeObserver, VariableMapObserver},
|
||||||
stages::{ShadowTracingStage, StdMutationalStage},
|
stages::{ShadowTracingStage, StdMutationalStage},
|
||||||
state::{HasCorpus, HasMetadata, StdState},
|
state::{HasCorpus, HasMetadata, StdState},
|
||||||
stats::SimpleStats,
|
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
use libafl_qemu::{
|
use libafl_qemu::{
|
||||||
@ -205,7 +205,7 @@ fn fuzz(
|
|||||||
let file_null = File::open("/dev/null")?;
|
let file_null = File::open("/dev/null")?;
|
||||||
|
|
||||||
// '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 stats = SimpleStats::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)]
|
||||||
@ -215,7 +215,8 @@ fn fuzz(
|
|||||||
|
|
||||||
let mut shmem_provider = StdShMemProvider::new()?;
|
let mut shmem_provider = StdShMemProvider::new()?;
|
||||||
|
|
||||||
let (state, mut mgr) = match SimpleRestartingEventManager::launch(stats, &mut shmem_provider) {
|
let (state, mut mgr) = match SimpleRestartingEventManager::launch(monitor, &mut shmem_provider)
|
||||||
|
{
|
||||||
// The restarting state will spawn the same process again as child, then restarted it each time it crashes.
|
// The restarting state will spawn the same process again as child, then restarted it each time it crashes.
|
||||||
Ok(res) => res,
|
Ok(res) => res,
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
|
@ -25,12 +25,12 @@ use libafl::{
|
|||||||
fuzzer::{Fuzzer, StdFuzzer},
|
fuzzer::{Fuzzer, StdFuzzer},
|
||||||
generators::RandBytesGenerator,
|
generators::RandBytesGenerator,
|
||||||
inputs::{BytesInput, HasTargetBytes},
|
inputs::{BytesInput, HasTargetBytes},
|
||||||
|
monitors::MultiMonitor,
|
||||||
mutators::scheduled::{havoc_mutations, tokens_mutations, StdScheduledMutator},
|
mutators::scheduled::{havoc_mutations, tokens_mutations, StdScheduledMutator},
|
||||||
mutators::token_mutations::{I2SRandReplace, Tokens},
|
mutators::token_mutations::{I2SRandReplace, Tokens},
|
||||||
observers::{HitcountsMapObserver, StdMapObserver, TimeObserver},
|
observers::{HitcountsMapObserver, StdMapObserver, TimeObserver},
|
||||||
stages::{StdMutationalStage, TracingStage},
|
stages::{StdMutationalStage, TracingStage},
|
||||||
state::{HasCorpus, HasMetadata, StdState},
|
state::{HasCorpus, HasMetadata, StdState},
|
||||||
stats::MultiStats,
|
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ pub fn libafl_main() {
|
|||||||
|
|
||||||
let shmem_provider = StdShMemProvider::new().expect("Failed to init shared memory");
|
let shmem_provider = StdShMemProvider::new().expect("Failed to init shared memory");
|
||||||
|
|
||||||
let stats = MultiStats::new(|s| println!("{}", s));
|
let monitor = MultiMonitor::new(|s| println!("{}", s));
|
||||||
|
|
||||||
let mut run_client = |state: Option<StdState<_, _, _, _, _>>, mut mgr, _core_id| {
|
let mut run_client = |state: Option<StdState<_, _, _, _, _>>, mut mgr, _core_id| {
|
||||||
// Create an observation channel using the coverage map
|
// Create an observation channel using the coverage map
|
||||||
@ -234,7 +234,7 @@ pub fn libafl_main() {
|
|||||||
match Launcher::builder()
|
match Launcher::builder()
|
||||||
.shmem_provider(shmem_provider)
|
.shmem_provider(shmem_provider)
|
||||||
.configuration(EventConfig::from_name("default"))
|
.configuration(EventConfig::from_name("default"))
|
||||||
.stats(stats)
|
.monitor(monitor)
|
||||||
.run_client(&mut run_client)
|
.run_client(&mut run_client)
|
||||||
.cores(&cores)
|
.cores(&cores)
|
||||||
.broker_port(broker_port)
|
.broker_port(broker_port)
|
||||||
|
@ -31,12 +31,12 @@ use libafl::{
|
|||||||
fuzzer::{Fuzzer, StdFuzzer},
|
fuzzer::{Fuzzer, StdFuzzer},
|
||||||
generators::RandBytesGenerator,
|
generators::RandBytesGenerator,
|
||||||
inputs::{BytesInput, HasTargetBytes},
|
inputs::{BytesInput, HasTargetBytes},
|
||||||
|
monitors::MultiMonitor,
|
||||||
mutators::scheduled::{havoc_mutations, tokens_mutations, StdScheduledMutator},
|
mutators::scheduled::{havoc_mutations, tokens_mutations, StdScheduledMutator},
|
||||||
mutators::token_mutations::{I2SRandReplace, Tokens},
|
mutators::token_mutations::{I2SRandReplace, Tokens},
|
||||||
observers::{HitcountsMapObserver, StdMapObserver, TimeObserver},
|
observers::{HitcountsMapObserver, StdMapObserver, TimeObserver},
|
||||||
stages::{StdMutationalStage, TracingStage},
|
stages::{StdMutationalStage, TracingStage},
|
||||||
state::{HasCorpus, HasMetadata, StdState},
|
state::{HasCorpus, HasMetadata, StdState},
|
||||||
stats::MultiStats,
|
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
use libafl_targets::{
|
use libafl_targets::{
|
||||||
@ -210,7 +210,7 @@ pub fn LLVMFuzzerRunDriver(
|
|||||||
|
|
||||||
let shmem_provider = StdShMemProvider::new().expect("Failed to init shared memory");
|
let shmem_provider = StdShMemProvider::new().expect("Failed to init shared memory");
|
||||||
|
|
||||||
let stats = MultiStats::new(|s| println!("{}", s));
|
let monitor = MultiMonitor::new(|s| println!("{}", s));
|
||||||
|
|
||||||
// TODO: we need to handle Atheris calls to `exit` on errors somhow.
|
// TODO: we need to handle Atheris calls to `exit` on errors somhow.
|
||||||
|
|
||||||
@ -359,7 +359,7 @@ pub fn LLVMFuzzerRunDriver(
|
|||||||
match Launcher::builder()
|
match Launcher::builder()
|
||||||
.shmem_provider(shmem_provider)
|
.shmem_provider(shmem_provider)
|
||||||
.configuration(EventConfig::from_name("default"))
|
.configuration(EventConfig::from_name("default"))
|
||||||
.stats(stats)
|
.monitor(monitor)
|
||||||
.run_client(&mut run_client)
|
.run_client(&mut run_client)
|
||||||
.cores(&cores)
|
.cores(&cores)
|
||||||
.broker_port(broker_port)
|
.broker_port(broker_port)
|
||||||
|
@ -16,12 +16,12 @@ use libafl::{
|
|||||||
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback},
|
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback},
|
||||||
fuzzer::{Fuzzer, StdFuzzer},
|
fuzzer::{Fuzzer, StdFuzzer},
|
||||||
inputs::{BytesInput, HasTargetBytes},
|
inputs::{BytesInput, HasTargetBytes},
|
||||||
|
monitors::SimpleMonitor,
|
||||||
mutators::scheduled::{havoc_mutations, tokens_mutations, StdScheduledMutator},
|
mutators::scheduled::{havoc_mutations, tokens_mutations, StdScheduledMutator},
|
||||||
mutators::token_mutations::Tokens,
|
mutators::token_mutations::Tokens,
|
||||||
observers::StdMapObserver,
|
observers::StdMapObserver,
|
||||||
stages::mutational::StdMutationalStage,
|
stages::mutational::StdMutationalStage,
|
||||||
state::{HasCorpus, HasMetadata, StdState},
|
state::{HasCorpus, HasMetadata, StdState},
|
||||||
stats::SimpleStats,
|
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -56,11 +56,11 @@ pub fn libafl_main() {
|
|||||||
/// The actual fuzzer
|
/// The actual fuzzer
|
||||||
fn fuzz(corpus_dirs: &[PathBuf], objective_dir: PathBuf, broker_port: u16) -> Result<(), Error> {
|
fn fuzz(corpus_dirs: &[PathBuf], objective_dir: PathBuf, broker_port: u16) -> Result<(), Error> {
|
||||||
// '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 stats = SimpleStats::new(|s| println!("{}", s));
|
let monitor = SimpleMonitor::new(|s| println!("{}", s));
|
||||||
|
|
||||||
// The restarting state will spawn the same process again as child, then restarted it each time it crashes.
|
// The restarting state will spawn the same process again as child, then restarted it each time it crashes.
|
||||||
let (state, mut restarting_mgr) =
|
let (state, mut restarting_mgr) =
|
||||||
match setup_restarting_mgr_std(stats, broker_port, EventConfig::from_name("default")) {
|
match setup_restarting_mgr_std(monitor, broker_port, EventConfig::from_name("default")) {
|
||||||
Ok(tuple) => tuple,
|
Ok(tuple) => tuple,
|
||||||
Err(Error::ShuttingDown) => {
|
Err(Error::ShuttingDown) => {
|
||||||
println!("\nFinished fuzzing. Good bye.");
|
println!("\nFinished fuzzing. Good bye.");
|
||||||
|
@ -20,6 +20,7 @@ use libafl::{
|
|||||||
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback, TimeFeedback, TimeoutFeedback},
|
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback, TimeFeedback, TimeoutFeedback},
|
||||||
fuzzer::{Fuzzer, StdFuzzer},
|
fuzzer::{Fuzzer, StdFuzzer},
|
||||||
inputs::{BytesInput, HasTargetBytes},
|
inputs::{BytesInput, HasTargetBytes},
|
||||||
|
monitors::MultiMonitor,
|
||||||
mutators::scheduled::{havoc_mutations, tokens_mutations, StdScheduledMutator},
|
mutators::scheduled::{havoc_mutations, tokens_mutations, StdScheduledMutator},
|
||||||
mutators::token_mutations::Tokens,
|
mutators::token_mutations::Tokens,
|
||||||
observers::{HitcountsMapObserver, StdMapObserver, TimeObserver},
|
observers::{HitcountsMapObserver, StdMapObserver, TimeObserver},
|
||||||
@ -28,7 +29,6 @@ use libafl::{
|
|||||||
power::{PowerMutationalStage, PowerSchedule},
|
power::{PowerMutationalStage, PowerSchedule},
|
||||||
},
|
},
|
||||||
state::{HasCorpus, HasMetadata, StdState},
|
state::{HasCorpus, HasMetadata, StdState},
|
||||||
stats::MultiStats,
|
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -57,11 +57,11 @@ pub fn libafl_main() {
|
|||||||
/// The actual fuzzer
|
/// The actual fuzzer
|
||||||
fn fuzz(corpus_dirs: &[PathBuf], objective_dir: PathBuf, broker_port: u16) -> Result<(), Error> {
|
fn fuzz(corpus_dirs: &[PathBuf], objective_dir: PathBuf, broker_port: u16) -> Result<(), Error> {
|
||||||
// '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 stats = MultiStats::new(|s| println!("{}", s));
|
let monitor = MultiMonitor::new(|s| println!("{}", s));
|
||||||
|
|
||||||
// The restarting state will spawn the same process again as child, then restarted it each time it crashes.
|
// The restarting state will spawn the same process again as child, then restarted it each time it crashes.
|
||||||
let (state, mut restarting_mgr) =
|
let (state, mut restarting_mgr) =
|
||||||
match setup_restarting_mgr_std(stats, broker_port, EventConfig::AlwaysUnique) {
|
match setup_restarting_mgr_std(monitor, broker_port, EventConfig::AlwaysUnique) {
|
||||||
Ok(res) => res,
|
Ok(res) => res,
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Error::ShuttingDown => {
|
Error::ShuttingDown => {
|
||||||
|
@ -26,12 +26,12 @@ use libafl::{
|
|||||||
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback, TimeFeedback, TimeoutFeedback},
|
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback, TimeFeedback, TimeoutFeedback},
|
||||||
fuzzer::{Fuzzer, StdFuzzer},
|
fuzzer::{Fuzzer, StdFuzzer},
|
||||||
inputs::{BytesInput, HasTargetBytes},
|
inputs::{BytesInput, HasTargetBytes},
|
||||||
|
monitors::MultiMonitor,
|
||||||
mutators::scheduled::{havoc_mutations, tokens_mutations, StdScheduledMutator},
|
mutators::scheduled::{havoc_mutations, tokens_mutations, StdScheduledMutator},
|
||||||
mutators::token_mutations::Tokens,
|
mutators::token_mutations::Tokens,
|
||||||
observers::{HitcountsMapObserver, StdMapObserver, TimeObserver},
|
observers::{HitcountsMapObserver, StdMapObserver, TimeObserver},
|
||||||
stages::mutational::StdMutationalStage,
|
stages::mutational::StdMutationalStage,
|
||||||
state::{HasCorpus, HasMetadata, StdState},
|
state::{HasCorpus, HasMetadata, StdState},
|
||||||
stats::MultiStats,
|
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ pub fn libafl_main() {
|
|||||||
|
|
||||||
let shmem_provider = StdShMemProvider::new().expect("Failed to init shared memory");
|
let shmem_provider = StdShMemProvider::new().expect("Failed to init shared memory");
|
||||||
|
|
||||||
let stats = MultiStats::new(|s| println!("{}", s));
|
let monitor = MultiMonitor::new(|s| println!("{}", s));
|
||||||
|
|
||||||
let mut run_client = |state: Option<StdState<_, _, _, _, _>>, mut restarting_mgr, _core_id| {
|
let mut run_client = |state: Option<StdState<_, _, _, _, _>>, mut restarting_mgr, _core_id| {
|
||||||
let corpus_dirs = &[PathBuf::from("./corpus")];
|
let corpus_dirs = &[PathBuf::from("./corpus")];
|
||||||
@ -168,7 +168,7 @@ pub fn libafl_main() {
|
|||||||
match Launcher::builder()
|
match Launcher::builder()
|
||||||
.shmem_provider(shmem_provider)
|
.shmem_provider(shmem_provider)
|
||||||
.configuration(EventConfig::from_name("default"))
|
.configuration(EventConfig::from_name("default"))
|
||||||
.stats(stats)
|
.monitor(monitor)
|
||||||
.run_client(&mut run_client)
|
.run_client(&mut run_client)
|
||||||
.cores(&cores)
|
.cores(&cores)
|
||||||
.broker_port(broker_port)
|
.broker_port(broker_port)
|
||||||
|
@ -11,11 +11,11 @@ use libafl::{
|
|||||||
feedbacks::{MapFeedbackState, MaxMapFeedback, ReachabilityFeedback},
|
feedbacks::{MapFeedbackState, MaxMapFeedback, ReachabilityFeedback},
|
||||||
fuzzer::{Fuzzer, StdFuzzer},
|
fuzzer::{Fuzzer, StdFuzzer},
|
||||||
inputs::{BytesInput, HasTargetBytes},
|
inputs::{BytesInput, HasTargetBytes},
|
||||||
|
monitors::SimpleMonitor,
|
||||||
mutators::scheduled::{havoc_mutations, StdScheduledMutator},
|
mutators::scheduled::{havoc_mutations, StdScheduledMutator},
|
||||||
observers::{HitcountsMapObserver, StdMapObserver},
|
observers::{HitcountsMapObserver, StdMapObserver},
|
||||||
stages::mutational::StdMutationalStage,
|
stages::mutational::StdMutationalStage,
|
||||||
state::{HasCorpus, StdState},
|
state::{HasCorpus, StdState},
|
||||||
stats::SimpleStats,
|
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
use libafl_targets::{libfuzzer_initialize, libfuzzer_test_one_input, EDGES_MAP, MAX_EDGES_NUM};
|
use libafl_targets::{libfuzzer_initialize, libfuzzer_test_one_input, EDGES_MAP, MAX_EDGES_NUM};
|
||||||
@ -48,11 +48,11 @@ pub fn libafl_main() {
|
|||||||
/// The actual fuzzer
|
/// The actual fuzzer
|
||||||
fn fuzz(corpus_dirs: &[PathBuf], objective_dir: PathBuf, broker_port: u16) -> Result<(), Error> {
|
fn fuzz(corpus_dirs: &[PathBuf], objective_dir: PathBuf, broker_port: u16) -> Result<(), Error> {
|
||||||
// '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 stats = SimpleStats::new(|s| println!("{}", s));
|
let monitor = SimpleMonitor::new(|s| println!("{}", s));
|
||||||
|
|
||||||
// The restarting state will spawn the same process again as child, then restarted it each time it crashes.
|
// The restarting state will spawn the same process again as child, then restarted it each time it crashes.
|
||||||
let (state, mut restarting_mgr) =
|
let (state, mut restarting_mgr) =
|
||||||
match setup_restarting_mgr_std(stats, broker_port, EventConfig::AlwaysUnique) {
|
match setup_restarting_mgr_std(monitor, broker_port, EventConfig::AlwaysUnique) {
|
||||||
Ok(res) => res,
|
Ok(res) => res,
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Error::ShuttingDown => {
|
Error::ShuttingDown => {
|
||||||
|
@ -15,12 +15,12 @@ use libafl::{
|
|||||||
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback, TimeFeedback},
|
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback, TimeFeedback},
|
||||||
fuzzer::{Fuzzer, StdFuzzer},
|
fuzzer::{Fuzzer, StdFuzzer},
|
||||||
inputs::{BytesInput, HasTargetBytes},
|
inputs::{BytesInput, HasTargetBytes},
|
||||||
|
monitors::MultiMonitor,
|
||||||
mutators::scheduled::{havoc_mutations, StdScheduledMutator},
|
mutators::scheduled::{havoc_mutations, StdScheduledMutator},
|
||||||
mutators::token_mutations::I2SRandReplace,
|
mutators::token_mutations::I2SRandReplace,
|
||||||
observers::{StdMapObserver, TimeObserver},
|
observers::{StdMapObserver, TimeObserver},
|
||||||
stages::{ShadowTracingStage, StdMutationalStage},
|
stages::{ShadowTracingStage, StdMutationalStage},
|
||||||
state::{HasCorpus, StdState},
|
state::{HasCorpus, StdState},
|
||||||
stats::MultiStats,
|
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -49,11 +49,11 @@ pub fn main() {
|
|||||||
/// The actual fuzzer
|
/// The actual fuzzer
|
||||||
fn fuzz(corpus_dirs: &[PathBuf], objective_dir: PathBuf, broker_port: u16) -> Result<(), Error> {
|
fn fuzz(corpus_dirs: &[PathBuf], objective_dir: PathBuf, broker_port: u16) -> Result<(), Error> {
|
||||||
// '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 stats = MultiStats::new(|s| println!("{}", s));
|
let monitor = MultiMonitor::new(|s| println!("{}", s));
|
||||||
|
|
||||||
// The restarting state will spawn the same process again as child, then restarted it each time it crashes.
|
// The restarting state will spawn the same process again as child, then restarted it each time it crashes.
|
||||||
let (state, mut restarting_mgr) =
|
let (state, mut restarting_mgr) =
|
||||||
match setup_restarting_mgr_std(stats, broker_port, EventConfig::from_name("default")) {
|
match setup_restarting_mgr_std(monitor, broker_port, EventConfig::from_name("default")) {
|
||||||
Ok(res) => res,
|
Ok(res) => res,
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Error::ShuttingDown => {
|
Error::ShuttingDown => {
|
||||||
|
@ -38,7 +38,7 @@ use libafl::{
|
|||||||
StdMutationalStage, TracingStage,
|
StdMutationalStage, TracingStage,
|
||||||
},
|
},
|
||||||
state::{HasCorpus, StdState},
|
state::{HasCorpus, StdState},
|
||||||
stats::MultiStats,
|
monitors::MultiMonitor,
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -84,11 +84,11 @@ fn fuzz(
|
|||||||
concolic: bool,
|
concolic: bool,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
// '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 stats = MultiStats::new(|s| println!("{}", s));
|
let monitor = MultiMonitor::new(|s| println!("{}", s));
|
||||||
|
|
||||||
// The restarting state will spawn the same process again as child, then restarted it each time it crashes.
|
// The restarting state will spawn the same process again as child, then restarted it each time it crashes.
|
||||||
let (state, mut restarting_mgr) =
|
let (state, mut restarting_mgr) =
|
||||||
match setup_restarting_mgr_std(stats, broker_port, EventConfig::from_name("default")) {
|
match setup_restarting_mgr_std(monitor, broker_port, EventConfig::from_name("default")) {
|
||||||
Ok(res) => res,
|
Ok(res) => res,
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Error::ShuttingDown => {
|
Error::ShuttingDown => {
|
||||||
|
@ -10,11 +10,11 @@ use libafl::{
|
|||||||
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback},
|
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback},
|
||||||
fuzzer::{Fuzzer, StdFuzzer},
|
fuzzer::{Fuzzer, StdFuzzer},
|
||||||
generators::RandPrintablesGenerator,
|
generators::RandPrintablesGenerator,
|
||||||
|
monitors::SimpleMonitor,
|
||||||
mutators::scheduled::{havoc_mutations, StdScheduledMutator},
|
mutators::scheduled::{havoc_mutations, StdScheduledMutator},
|
||||||
observers::StdMapObserver,
|
observers::StdMapObserver,
|
||||||
stages::mutational::StdMutationalStage,
|
stages::mutational::StdMutationalStage,
|
||||||
state::StdState,
|
state::StdState,
|
||||||
stats::SimpleStats,
|
|
||||||
};
|
};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
@ -63,12 +63,12 @@ fn input_generator() {
|
|||||||
tuple_list!(feedback_state),
|
tuple_list!(feedback_state),
|
||||||
);
|
);
|
||||||
|
|
||||||
// The Stats 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 stats = SimpleStats::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
|
||||||
let mut mgr = SimpleEventManager::new(stats);
|
let mut mgr = SimpleEventManager::new(monitor);
|
||||||
|
|
||||||
// A queue policy to get testcasess from the corpus
|
// A queue policy to get testcasess from the corpus
|
||||||
let scheduler = QueueCorpusScheduler::new();
|
let scheduler = QueueCorpusScheduler::new();
|
||||||
|
@ -17,11 +17,11 @@ use libafl::{
|
|||||||
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback},
|
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback},
|
||||||
fuzzer::StdFuzzer,
|
fuzzer::StdFuzzer,
|
||||||
inputs::{BytesInput, HasTargetBytes},
|
inputs::{BytesInput, HasTargetBytes},
|
||||||
|
monitors::SimpleMonitor,
|
||||||
mutators::scheduled::{havoc_mutations, StdScheduledMutator},
|
mutators::scheduled::{havoc_mutations, StdScheduledMutator},
|
||||||
observers::StdMapObserver,
|
observers::StdMapObserver,
|
||||||
stages::push::StdMutationalPushStage,
|
stages::push::StdMutationalPushStage,
|
||||||
state::{HasCorpus, StdState},
|
state::{HasCorpus, StdState},
|
||||||
stats::SimpleStats,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Coverage map with explicit assignments due to the lack of instrumentation
|
/// Coverage map with explicit assignments due to the lack of instrumentation
|
||||||
@ -60,12 +60,12 @@ pub fn main() {
|
|||||||
tuple_list!(feedback_state),
|
tuple_list!(feedback_state),
|
||||||
);
|
);
|
||||||
|
|
||||||
// The Stats 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 stats = SimpleStats::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
|
||||||
let mgr = SimpleEventManager::new(stats);
|
let mgr = SimpleEventManager::new(monitor);
|
||||||
|
|
||||||
// A queue policy to get testcasess from the corpus
|
// A queue policy to get testcasess from the corpus
|
||||||
let scheduler = QueueCorpusScheduler::new();
|
let scheduler = QueueCorpusScheduler::new();
|
||||||
|
@ -15,13 +15,13 @@ use libafl::{
|
|||||||
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback, TimeFeedback, TimeoutFeedback},
|
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback, TimeFeedback, TimeoutFeedback},
|
||||||
fuzzer::{Fuzzer, StdFuzzer},
|
fuzzer::{Fuzzer, StdFuzzer},
|
||||||
inputs::HasTargetBytes,
|
inputs::HasTargetBytes,
|
||||||
|
monitors::MultiMonitor,
|
||||||
observers::{HitcountsMapObserver, StdMapObserver, TimeObserver},
|
observers::{HitcountsMapObserver, StdMapObserver, TimeObserver},
|
||||||
stages::{
|
stages::{
|
||||||
calibrate::CalibrationStage,
|
calibrate::CalibrationStage,
|
||||||
power::{PowerMutationalStage, PowerSchedule},
|
power::{PowerMutationalStage, PowerSchedule},
|
||||||
},
|
},
|
||||||
state::{HasCorpus, StdState},
|
state::{HasCorpus, StdState},
|
||||||
stats::MultiStats,
|
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -67,11 +67,11 @@ fn fuzz(corpus_dirs: &[PathBuf], objective_dir: PathBuf, broker_port: u16) -> Re
|
|||||||
};
|
};
|
||||||
|
|
||||||
// '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 stats = MultiStats::new(|s| println!("{}", s));
|
let monitor = MultiMonitor::new(|s| println!("{}", s));
|
||||||
|
|
||||||
// The restarting state will spawn the same process again as child, then restarted it each time it crashes.
|
// The restarting state will spawn the same process again as child, then restarted it each time it crashes.
|
||||||
let (state, mut restarting_mgr) =
|
let (state, mut restarting_mgr) =
|
||||||
match setup_restarting_mgr_std(stats, broker_port, EventConfig::AlwaysUnique) {
|
match setup_restarting_mgr_std(monitor, broker_port, EventConfig::AlwaysUnique) {
|
||||||
Ok(res) => res,
|
Ok(res) => res,
|
||||||
Err(err) => match err {
|
Err(err) => match err {
|
||||||
Error::ShuttingDown => {
|
Error::ShuttingDown => {
|
||||||
|
@ -5,7 +5,7 @@ use libafl::{
|
|||||||
executors::ExitKind,
|
executors::ExitKind,
|
||||||
feedbacks::{Feedback, MapIndexesMetadata},
|
feedbacks::{Feedback, MapIndexesMetadata},
|
||||||
observers::ObserversTuple,
|
observers::ObserversTuple,
|
||||||
state::{HasClientPerfStats, HasMetadata},
|
state::{HasClientPerfMonitor, HasMetadata},
|
||||||
Error, SerdeAny,
|
Error, SerdeAny,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ pub struct PacketLenFeedback {
|
|||||||
|
|
||||||
impl<S> Feedback<PacketData, S> for PacketLenFeedback
|
impl<S> Feedback<PacketData, S> for PacketLenFeedback
|
||||||
where
|
where
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
fn is_interesting<EM, OT>(
|
fn is_interesting<EM, OT>(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
@ -19,8 +19,8 @@ use crate::{
|
|||||||
bolts::shmem::ShMemProvider,
|
bolts::shmem::ShMemProvider,
|
||||||
events::{EventConfig, LlmpRestartingEventManager, ManagerKind, RestartingMgr},
|
events::{EventConfig, LlmpRestartingEventManager, ManagerKind, RestartingMgr},
|
||||||
inputs::Input,
|
inputs::Input,
|
||||||
|
monitors::Monitor,
|
||||||
observers::ObserversTuple,
|
observers::ObserversTuple,
|
||||||
stats::Stats,
|
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -45,19 +45,19 @@ const _AFL_LAUNCHER_CLIENT: &str = "AFL_LAUNCHER_CLIENT";
|
|||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
#[derive(TypedBuilder)]
|
#[derive(TypedBuilder)]
|
||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
pub struct Launcher<'a, CF, I, OT, S, SP, ST>
|
pub struct Launcher<'a, CF, I, MT, OT, S, SP>
|
||||||
where
|
where
|
||||||
CF: FnOnce(Option<S>, LlmpRestartingEventManager<I, OT, S, SP>, usize) -> Result<(), Error>,
|
CF: FnOnce(Option<S>, LlmpRestartingEventManager<I, OT, S, SP>, usize) -> Result<(), Error>,
|
||||||
I: Input + 'a,
|
I: Input + 'a,
|
||||||
ST: Stats,
|
MT: Monitor,
|
||||||
SP: ShMemProvider + 'static,
|
SP: ShMemProvider + 'static,
|
||||||
OT: ObserversTuple<I, S> + 'a,
|
OT: ObserversTuple<I, S> + 'a,
|
||||||
S: DeserializeOwned + 'a,
|
S: DeserializeOwned + 'a,
|
||||||
{
|
{
|
||||||
/// The ShmemProvider to use
|
/// The ShmemProvider to use
|
||||||
shmem_provider: SP,
|
shmem_provider: SP,
|
||||||
/// The stats instance to use
|
/// The monitor instance to use
|
||||||
stats: ST,
|
monitor: MT,
|
||||||
/// The configuration
|
/// The configuration
|
||||||
configuration: EventConfig,
|
configuration: EventConfig,
|
||||||
/// The 'main' function to run for each client forked. This probably shouldn't return
|
/// The 'main' function to run for each client forked. This probably shouldn't return
|
||||||
@ -86,12 +86,12 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
impl<'a, CF, I, OT, S, SP, ST> Launcher<'a, CF, I, OT, S, SP, ST>
|
impl<'a, CF, I, MT, OT, S, SP> Launcher<'a, CF, I, MT, OT, S, SP>
|
||||||
where
|
where
|
||||||
CF: FnOnce(Option<S>, LlmpRestartingEventManager<I, OT, S, SP>, usize) -> Result<(), Error>,
|
CF: FnOnce(Option<S>, LlmpRestartingEventManager<I, OT, S, SP>, usize) -> Result<(), Error>,
|
||||||
I: Input,
|
I: Input,
|
||||||
OT: ObserversTuple<I, S> + serde::de::DeserializeOwned,
|
OT: ObserversTuple<I, S> + serde::de::DeserializeOwned,
|
||||||
ST: Stats + Clone,
|
MT: Monitor + Clone,
|
||||||
SP: ShMemProvider + 'static,
|
SP: ShMemProvider + 'static,
|
||||||
S: DeserializeOwned,
|
S: DeserializeOwned,
|
||||||
{
|
{
|
||||||
@ -138,7 +138,7 @@ where
|
|||||||
dup2(file.as_raw_fd(), libc::STDERR_FILENO)?;
|
dup2(file.as_raw_fd(), libc::STDERR_FILENO)?;
|
||||||
}
|
}
|
||||||
// Fuzzer client. keeps retrying the connection to broker till the broker starts
|
// Fuzzer client. keeps retrying the connection to broker till the broker starts
|
||||||
let (state, mgr) = RestartingMgr::<I, OT, S, SP, ST>::builder()
|
let (state, mgr) = RestartingMgr::<I, MT, OT, S, SP>::builder()
|
||||||
.shmem_provider(self.shmem_provider.clone())
|
.shmem_provider(self.shmem_provider.clone())
|
||||||
.broker_port(self.broker_port)
|
.broker_port(self.broker_port)
|
||||||
.kind(ManagerKind::Client {
|
.kind(ManagerKind::Client {
|
||||||
@ -161,9 +161,9 @@ where
|
|||||||
println!("I am broker!!.");
|
println!("I am broker!!.");
|
||||||
|
|
||||||
// TODO we don't want always a broker here, think about using different laucher process to spawn different configurations
|
// TODO we don't want always a broker here, think about using different laucher process to spawn different configurations
|
||||||
RestartingMgr::<I, OT, S, SP, ST>::builder()
|
RestartingMgr::<I, MT, OT, S, SP>::builder()
|
||||||
.shmem_provider(self.shmem_provider.clone())
|
.shmem_provider(self.shmem_provider.clone())
|
||||||
.stats(Some(self.stats.clone()))
|
.monitor(Some(self.monitor.clone()))
|
||||||
.broker_port(self.broker_port)
|
.broker_port(self.broker_port)
|
||||||
.kind(ManagerKind::Broker)
|
.kind(ManagerKind::Broker)
|
||||||
.remote_broker_addr(self.remote_broker_addr)
|
.remote_broker_addr(self.remote_broker_addr)
|
||||||
@ -206,7 +206,7 @@ where
|
|||||||
//todo: silence stdout and stderr for clients
|
//todo: silence stdout and stderr for clients
|
||||||
|
|
||||||
// the actual client. do the fuzzing
|
// the actual client. do the fuzzing
|
||||||
let (state, mgr) = RestartingMgr::<I, OT, S, SP, ST>::builder()
|
let (state, mgr) = RestartingMgr::<I, MT, OT, S, SP>::builder()
|
||||||
.shmem_provider(self.shmem_provider.clone())
|
.shmem_provider(self.shmem_provider.clone())
|
||||||
.broker_port(self.broker_port)
|
.broker_port(self.broker_port)
|
||||||
.kind(ManagerKind::Client {
|
.kind(ManagerKind::Client {
|
||||||
@ -259,9 +259,9 @@ where
|
|||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
println!("I am broker!!.");
|
println!("I am broker!!.");
|
||||||
|
|
||||||
RestartingMgr::<I, OT, S, SP, ST>::builder()
|
RestartingMgr::<I, MT, OT, S, SP>::builder()
|
||||||
.shmem_provider(self.shmem_provider.clone())
|
.shmem_provider(self.shmem_provider.clone())
|
||||||
.stats(Some(self.stats.clone()))
|
.monitor(Some(self.monitor.clone()))
|
||||||
.broker_port(self.broker_port)
|
.broker_port(self.broker_port)
|
||||||
.kind(ManagerKind::Broker)
|
.kind(ManagerKind::Broker)
|
||||||
.remote_broker_addr(self.remote_broker_addr)
|
.remote_broker_addr(self.remote_broker_addr)
|
||||||
|
@ -31,8 +31,8 @@ use crate::{
|
|||||||
executors::{Executor, HasObservers},
|
executors::{Executor, HasObservers},
|
||||||
fuzzer::{EvaluatorObservers, ExecutionProcessor},
|
fuzzer::{EvaluatorObservers, ExecutionProcessor},
|
||||||
inputs::Input,
|
inputs::Input,
|
||||||
|
monitors::Monitor,
|
||||||
observers::ObserversTuple,
|
observers::ObserversTuple,
|
||||||
stats::Stats,
|
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -66,30 +66,30 @@ const _LLMP_TAG_NO_RESTART: llmp::Tag = 0x57A7EE71;
|
|||||||
const COMPRESS_THRESHOLD: usize = 1024;
|
const COMPRESS_THRESHOLD: usize = 1024;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct LlmpEventBroker<I, SP, ST>
|
pub struct LlmpEventBroker<I, MT, SP>
|
||||||
where
|
where
|
||||||
I: Input,
|
I: Input,
|
||||||
SP: ShMemProvider + 'static,
|
SP: ShMemProvider + 'static,
|
||||||
ST: Stats,
|
MT: Monitor,
|
||||||
//CE: CustomEvent<I>,
|
//CE: CustomEvent<I>,
|
||||||
{
|
{
|
||||||
stats: ST,
|
monitor: MT,
|
||||||
llmp: llmp::LlmpBroker<SP>,
|
llmp: llmp::LlmpBroker<SP>,
|
||||||
#[cfg(feature = "llmp_compression")]
|
#[cfg(feature = "llmp_compression")]
|
||||||
compressor: GzipCompressor,
|
compressor: GzipCompressor,
|
||||||
phantom: PhantomData<I>,
|
phantom: PhantomData<I>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<I, SP, ST> LlmpEventBroker<I, SP, ST>
|
impl<I, MT, SP> LlmpEventBroker<I, MT, SP>
|
||||||
where
|
where
|
||||||
I: Input,
|
I: Input,
|
||||||
SP: ShMemProvider + 'static,
|
SP: ShMemProvider + 'static,
|
||||||
ST: Stats,
|
MT: Monitor,
|
||||||
{
|
{
|
||||||
/// Create an even broker from a raw broker.
|
/// Create an even broker from a raw broker.
|
||||||
pub fn new(llmp: llmp::LlmpBroker<SP>, stats: ST) -> Result<Self, Error> {
|
pub fn new(llmp: llmp::LlmpBroker<SP>, monitor: MT) -> Result<Self, Error> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
stats,
|
monitor,
|
||||||
llmp,
|
llmp,
|
||||||
#[cfg(feature = "llmp_compression")]
|
#[cfg(feature = "llmp_compression")]
|
||||||
compressor: GzipCompressor::new(COMPRESS_THRESHOLD),
|
compressor: GzipCompressor::new(COMPRESS_THRESHOLD),
|
||||||
@ -100,9 +100,9 @@ where
|
|||||||
/// Create llmp on a port
|
/// Create llmp on a port
|
||||||
/// The port must not be bound yet to have a broker.
|
/// The port must not be bound yet to have a broker.
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
pub fn new_on_port(shmem_provider: SP, stats: ST, port: u16) -> Result<Self, Error> {
|
pub fn new_on_port(shmem_provider: SP, monitor: MT, port: u16) -> Result<Self, Error> {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
stats,
|
monitor,
|
||||||
llmp: llmp::LlmpBroker::create_attach_to_tcp(shmem_provider, port)?,
|
llmp: llmp::LlmpBroker::create_attach_to_tcp(shmem_provider, port)?,
|
||||||
#[cfg(feature = "llmp_compression")]
|
#[cfg(feature = "llmp_compression")]
|
||||||
compressor: GzipCompressor::new(COMPRESS_THRESHOLD),
|
compressor: GzipCompressor::new(COMPRESS_THRESHOLD),
|
||||||
@ -120,7 +120,7 @@ where
|
|||||||
|
|
||||||
/// Run forever in the broker
|
/// Run forever in the broker
|
||||||
pub fn broker_loop(&mut self) -> Result<(), Error> {
|
pub fn broker_loop(&mut self) -> Result<(), Error> {
|
||||||
let stats = &mut self.stats;
|
let monitor = &mut self.monitor;
|
||||||
#[cfg(feature = "llmp_compression")]
|
#[cfg(feature = "llmp_compression")]
|
||||||
let compressor = &self.compressor;
|
let compressor = &self.compressor;
|
||||||
self.llmp.loop_forever(
|
self.llmp.loop_forever(
|
||||||
@ -138,7 +138,7 @@ where
|
|||||||
msg
|
msg
|
||||||
};
|
};
|
||||||
let event: Event<I> = postcard::from_bytes(event_bytes)?;
|
let event: Event<I> = postcard::from_bytes(event_bytes)?;
|
||||||
match Self::handle_in_broker(stats, client_id, &event)? {
|
match Self::handle_in_broker(monitor, client_id, &event)? {
|
||||||
BrokerEventResult::Forward => Ok(llmp::LlmpMsgHookResult::ForwardToClients),
|
BrokerEventResult::Forward => Ok(llmp::LlmpMsgHookResult::ForwardToClients),
|
||||||
BrokerEventResult::Handled => Ok(llmp::LlmpMsgHookResult::Handled),
|
BrokerEventResult::Handled => Ok(llmp::LlmpMsgHookResult::Handled),
|
||||||
}
|
}
|
||||||
@ -155,7 +155,7 @@ where
|
|||||||
/// Handle arriving events in the broker
|
/// Handle arriving events in the broker
|
||||||
#[allow(clippy::unnecessary_wraps)]
|
#[allow(clippy::unnecessary_wraps)]
|
||||||
fn handle_in_broker(
|
fn handle_in_broker(
|
||||||
stats: &mut ST,
|
monitor: &mut MT,
|
||||||
client_id: u32,
|
client_id: u32,
|
||||||
event: &Event<I>,
|
event: &Event<I>,
|
||||||
) -> Result<BrokerEventResult, Error> {
|
) -> Result<BrokerEventResult, Error> {
|
||||||
@ -169,21 +169,21 @@ where
|
|||||||
time,
|
time,
|
||||||
executions,
|
executions,
|
||||||
} => {
|
} => {
|
||||||
let client = stats.client_stats_mut_for(client_id);
|
let client = monitor.client_stats_mut_for(client_id);
|
||||||
client.update_corpus_size(*corpus_size as u64);
|
client.update_corpus_size(*corpus_size as u64);
|
||||||
client.update_executions(*executions as u64, *time);
|
client.update_executions(*executions as u64, *time);
|
||||||
stats.display(event.name().to_string(), client_id);
|
monitor.display(event.name().to_string(), client_id);
|
||||||
Ok(BrokerEventResult::Forward)
|
Ok(BrokerEventResult::Forward)
|
||||||
}
|
}
|
||||||
Event::UpdateStats {
|
Event::UpdateExecutions {
|
||||||
time,
|
time,
|
||||||
executions,
|
executions,
|
||||||
phantom: _,
|
phantom: _,
|
||||||
} => {
|
} => {
|
||||||
// TODO: The stats buffer should be added on client add.
|
// TODO: The monitor buffer should be added on client add.
|
||||||
let client = stats.client_stats_mut_for(client_id);
|
let client = monitor.client_stats_mut_for(client_id);
|
||||||
client.update_executions(*executions as u64, *time);
|
client.update_executions(*executions as u64, *time);
|
||||||
stats.display(event.name().to_string(), client_id);
|
monitor.display(event.name().to_string(), client_id);
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
}
|
}
|
||||||
Event::UpdateUserStats {
|
Event::UpdateUserStats {
|
||||||
@ -191,39 +191,39 @@ where
|
|||||||
value,
|
value,
|
||||||
phantom: _,
|
phantom: _,
|
||||||
} => {
|
} => {
|
||||||
let client = stats.client_stats_mut_for(client_id);
|
let client = monitor.client_stats_mut_for(client_id);
|
||||||
client.update_user_stats(name.clone(), value.clone());
|
client.update_user_stats(name.clone(), value.clone());
|
||||||
stats.display(event.name().to_string(), client_id);
|
monitor.display(event.name().to_string(), client_id);
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
}
|
}
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
Event::UpdatePerfStats {
|
Event::UpdatePerfMonitor {
|
||||||
time,
|
time,
|
||||||
executions,
|
executions,
|
||||||
introspection_stats,
|
introspection_monitor,
|
||||||
phantom: _,
|
phantom: _,
|
||||||
} => {
|
} => {
|
||||||
// TODO: The stats buffer should be added on client add.
|
// TODO: The monitor buffer should be added on client add.
|
||||||
|
|
||||||
// Get the client for the staterestorer ID
|
// Get the client for the staterestorer ID
|
||||||
let client = stats.client_stats_mut_for(client_id);
|
let client = monitor.client_stats_mut_for(client_id);
|
||||||
|
|
||||||
// Update the normal stats for this client
|
// Update the normal monitor for this client
|
||||||
client.update_executions(*executions as u64, *time);
|
client.update_executions(*executions as u64, *time);
|
||||||
|
|
||||||
// Update the performance stats for this client
|
// Update the performance monitor for this client
|
||||||
client.update_introspection_stats((**introspection_stats).clone());
|
client.update_introspection_monitor((**introspection_monitor).clone());
|
||||||
|
|
||||||
// Display the stats via `.display` only on core #1
|
// Display the monitor via `.display` only on core #1
|
||||||
stats.display(event.name().to_string(), client_id);
|
monitor.display(event.name().to_string(), client_id);
|
||||||
|
|
||||||
// Correctly handled the event
|
// Correctly handled the event
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
}
|
}
|
||||||
Event::Objective { objective_size } => {
|
Event::Objective { objective_size } => {
|
||||||
let client = stats.client_stats_mut_for(client_id);
|
let client = monitor.client_stats_mut_for(client_id);
|
||||||
client.update_objective_size(*objective_size as u64);
|
client.update_objective_size(*objective_size as u64);
|
||||||
stats.display(event.name().to_string(), client_id);
|
monitor.display(event.name().to_string(), client_id);
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
}
|
}
|
||||||
Event::Log {
|
Event::Log {
|
||||||
@ -232,7 +232,7 @@ where
|
|||||||
phantom: _,
|
phantom: _,
|
||||||
} => {
|
} => {
|
||||||
let (_, _) = (severity_level, message);
|
let (_, _) = (severity_level, message);
|
||||||
// TODO rely on Stats
|
// TODO rely on Monitor
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
println!("[LOG {}]: {}", severity_level, message);
|
println!("[LOG {}]: {}", severity_level, message);
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
@ -672,8 +672,8 @@ pub enum ManagerKind {
|
|||||||
/// The restarter will spawn a new process each time the child crashes or timeouts.
|
/// The restarter will spawn a new process each time the child crashes or timeouts.
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
pub fn setup_restarting_mgr_std<I, OT, S, ST>(
|
pub fn setup_restarting_mgr_std<I, MT, OT, S>(
|
||||||
stats: ST,
|
monitor: MT,
|
||||||
broker_port: u16,
|
broker_port: u16,
|
||||||
configuration: EventConfig,
|
configuration: EventConfig,
|
||||||
) -> Result<
|
) -> Result<
|
||||||
@ -686,13 +686,13 @@ pub fn setup_restarting_mgr_std<I, OT, S, ST>(
|
|||||||
where
|
where
|
||||||
I: Input,
|
I: Input,
|
||||||
S: DeserializeOwned,
|
S: DeserializeOwned,
|
||||||
ST: Stats + Clone,
|
MT: Monitor + Clone,
|
||||||
OT: ObserversTuple<I, S> + serde::de::DeserializeOwned,
|
OT: ObserversTuple<I, S> + serde::de::DeserializeOwned,
|
||||||
S: DeserializeOwned,
|
S: DeserializeOwned,
|
||||||
{
|
{
|
||||||
RestartingMgr::builder()
|
RestartingMgr::builder()
|
||||||
.shmem_provider(StdShMemProvider::new()?)
|
.shmem_provider(StdShMemProvider::new()?)
|
||||||
.stats(Some(stats))
|
.monitor(Some(monitor))
|
||||||
.broker_port(broker_port)
|
.broker_port(broker_port)
|
||||||
.configuration(configuration)
|
.configuration(configuration)
|
||||||
.build()
|
.build()
|
||||||
@ -705,13 +705,13 @@ where
|
|||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
#[allow(clippy::default_trait_access)]
|
#[allow(clippy::default_trait_access)]
|
||||||
#[derive(TypedBuilder, Debug)]
|
#[derive(TypedBuilder, Debug)]
|
||||||
pub struct RestartingMgr<I, OT, S, SP, ST>
|
pub struct RestartingMgr<I, MT, OT, S, SP>
|
||||||
where
|
where
|
||||||
I: Input,
|
I: Input,
|
||||||
OT: ObserversTuple<I, S> + serde::de::DeserializeOwned,
|
OT: ObserversTuple<I, S> + serde::de::DeserializeOwned,
|
||||||
S: DeserializeOwned,
|
S: DeserializeOwned,
|
||||||
SP: ShMemProvider + 'static,
|
SP: ShMemProvider + 'static,
|
||||||
ST: Stats,
|
MT: Monitor,
|
||||||
//CE: CustomEvent<I>,
|
//CE: CustomEvent<I>,
|
||||||
{
|
{
|
||||||
/// The shared memory provider to use for the broker or client spawned by the restarting
|
/// The shared memory provider to use for the broker or client spawned by the restarting
|
||||||
@ -719,9 +719,9 @@ where
|
|||||||
shmem_provider: SP,
|
shmem_provider: SP,
|
||||||
/// The configuration
|
/// The configuration
|
||||||
configuration: EventConfig,
|
configuration: EventConfig,
|
||||||
/// The stats to use
|
/// The monitor to use
|
||||||
#[builder(default = None)]
|
#[builder(default = None)]
|
||||||
stats: Option<ST>,
|
monitor: Option<MT>,
|
||||||
/// The broker port to use
|
/// The broker port to use
|
||||||
#[builder(default = 1337_u16)]
|
#[builder(default = 1337_u16)]
|
||||||
broker_port: u16,
|
broker_port: u16,
|
||||||
@ -737,13 +737,13 @@ where
|
|||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
#[allow(clippy::type_complexity, clippy::too_many_lines)]
|
#[allow(clippy::type_complexity, clippy::too_many_lines)]
|
||||||
impl<I, OT, S, SP, ST> RestartingMgr<I, OT, S, SP, ST>
|
impl<I, MT, OT, S, SP> RestartingMgr<I, MT, OT, S, SP>
|
||||||
where
|
where
|
||||||
I: Input,
|
I: Input,
|
||||||
OT: ObserversTuple<I, S> + serde::de::DeserializeOwned,
|
OT: ObserversTuple<I, S> + serde::de::DeserializeOwned,
|
||||||
S: DeserializeOwned,
|
S: DeserializeOwned,
|
||||||
SP: ShMemProvider,
|
SP: ShMemProvider,
|
||||||
ST: Stats + Clone,
|
MT: Monitor + Clone,
|
||||||
{
|
{
|
||||||
/// Launch the restarting manager
|
/// Launch the restarting manager
|
||||||
pub fn launch(
|
pub fn launch(
|
||||||
@ -753,7 +753,7 @@ where
|
|||||||
let (staterestorer, new_shmem_provider, core_id) = if std::env::var(_ENV_FUZZER_SENDER)
|
let (staterestorer, new_shmem_provider, core_id) = if std::env::var(_ENV_FUZZER_SENDER)
|
||||||
.is_err()
|
.is_err()
|
||||||
{
|
{
|
||||||
let broker_things = |mut broker: LlmpEventBroker<I, SP, ST>, remote_broker_addr| {
|
let broker_things = |mut broker: LlmpEventBroker<I, MT, SP>, remote_broker_addr| {
|
||||||
if let Some(remote_broker_addr) = remote_broker_addr {
|
if let Some(remote_broker_addr) = remote_broker_addr {
|
||||||
println!("B2b: Connecting to {:?}", &remote_broker_addr);
|
println!("B2b: Connecting to {:?}", &remote_broker_addr);
|
||||||
broker.connect_b2b(remote_broker_addr)?;
|
broker.connect_b2b(remote_broker_addr)?;
|
||||||
@ -769,9 +769,9 @@ where
|
|||||||
LlmpConnection::on_port(self.shmem_provider.clone(), self.broker_port)?;
|
LlmpConnection::on_port(self.shmem_provider.clone(), self.broker_port)?;
|
||||||
match connection {
|
match connection {
|
||||||
LlmpConnection::IsBroker { broker } => {
|
LlmpConnection::IsBroker { broker } => {
|
||||||
let event_broker = LlmpEventBroker::<I, SP, ST>::new(
|
let event_broker = LlmpEventBroker::<I, MT, SP>::new(
|
||||||
broker,
|
broker,
|
||||||
self.stats.take().unwrap(),
|
self.monitor.take().unwrap(),
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// Yep, broker. Just loop here.
|
// Yep, broker. Just loop here.
|
||||||
@ -791,9 +791,9 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ManagerKind::Broker => {
|
ManagerKind::Broker => {
|
||||||
let event_broker = LlmpEventBroker::<I, SP, ST>::new_on_port(
|
let event_broker = LlmpEventBroker::<I, MT, SP>::new_on_port(
|
||||||
self.shmem_provider.clone(),
|
self.shmem_provider.clone(),
|
||||||
self.stats.take().unwrap(),
|
self.monitor.take().unwrap(),
|
||||||
self.broker_port,
|
self.broker_port,
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
executors::ExitKind, inputs::Input, observers::ObserversTuple, stats::UserStats, Error,
|
executors::ExitKind, inputs::Input, monitors::UserStats, observers::ObserversTuple, Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// A per-fuzzer unique `ID`, usually starting with `0` and increasing
|
/// A per-fuzzer unique `ID`, usually starting with `0` and increasing
|
||||||
@ -26,7 +26,7 @@ pub struct EventManagerId {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
use crate::stats::ClientPerfStats;
|
use crate::monitors::ClientPerfMonitor;
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
|
|
||||||
@ -169,8 +169,8 @@ where
|
|||||||
/// The executions of this client
|
/// The executions of this client
|
||||||
executions: usize,
|
executions: usize,
|
||||||
},
|
},
|
||||||
/// New stats.
|
/// New stats event to monitor.
|
||||||
UpdateStats {
|
UpdateExecutions {
|
||||||
/// The time of generation of the [`Event`]
|
/// The time of generation of the [`Event`]
|
||||||
time: Duration,
|
time: Duration,
|
||||||
/// The executions of this client
|
/// The executions of this client
|
||||||
@ -178,18 +178,18 @@ where
|
|||||||
/// [`PhantomData`]
|
/// [`PhantomData`]
|
||||||
phantom: PhantomData<I>,
|
phantom: PhantomData<I>,
|
||||||
},
|
},
|
||||||
/// New stats.
|
/// New user stats event to monitor.
|
||||||
UpdateUserStats {
|
UpdateUserStats {
|
||||||
/// Custom user stats name
|
/// Custom user monitor name
|
||||||
name: String,
|
name: String,
|
||||||
/// Custom user stats value
|
/// Custom user monitor value
|
||||||
value: UserStats,
|
value: UserStats,
|
||||||
/// [`PhantomData`]
|
/// [`PhantomData`]
|
||||||
phantom: PhantomData<I>,
|
phantom: PhantomData<I>,
|
||||||
},
|
},
|
||||||
/// New stats with performance stats.
|
/// New monitor with performance monitor.
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
UpdatePerfStats {
|
UpdatePerfMonitor {
|
||||||
/// The time of generation of the event
|
/// The time of generation of the event
|
||||||
time: Duration,
|
time: Duration,
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ where
|
|||||||
executions: usize,
|
executions: usize,
|
||||||
|
|
||||||
/// Current performance statistics
|
/// Current performance statistics
|
||||||
introspection_stats: Box<ClientPerfStats>,
|
introspection_monitor: Box<ClientPerfMonitor>,
|
||||||
|
|
||||||
phantom: PhantomData<I>,
|
phantom: PhantomData<I>,
|
||||||
},
|
},
|
||||||
@ -237,7 +237,7 @@ where
|
|||||||
time: _,
|
time: _,
|
||||||
executions: _,
|
executions: _,
|
||||||
} => "Testcase",
|
} => "Testcase",
|
||||||
Event::UpdateStats {
|
Event::UpdateExecutions {
|
||||||
time: _,
|
time: _,
|
||||||
executions: _,
|
executions: _,
|
||||||
phantom: _,
|
phantom: _,
|
||||||
@ -248,12 +248,12 @@ where
|
|||||||
phantom: _,
|
phantom: _,
|
||||||
} => "Stats",
|
} => "Stats",
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
Event::UpdatePerfStats {
|
Event::UpdatePerfMonitor {
|
||||||
time: _,
|
time: _,
|
||||||
executions: _,
|
executions: _,
|
||||||
introspection_stats: _,
|
introspection_monitor: _,
|
||||||
phantom: _,
|
phantom: _,
|
||||||
} => "PerfStats",
|
} => "PerfMonitor",
|
||||||
Event::Objective { objective_size: _ } => "Objective",
|
Event::Objective { objective_size: _ } => "Objective",
|
||||||
Event::Log {
|
Event::Log {
|
||||||
severity_level: _,
|
severity_level: _,
|
||||||
|
@ -6,7 +6,7 @@ use crate::{
|
|||||||
EventRestarter, HasEventManagerId,
|
EventRestarter, HasEventManagerId,
|
||||||
},
|
},
|
||||||
inputs::Input,
|
inputs::Input,
|
||||||
stats::Stats,
|
monitors::Monitor,
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
use alloc::{string::ToString, vec::Vec};
|
use alloc::{string::ToString, vec::Vec};
|
||||||
@ -37,24 +37,24 @@ const _ENV_FUZZER_BROKER_CLIENT_INITIAL: &str = "_AFL_ENV_FUZZER_BROKER_CLIENT";
|
|||||||
|
|
||||||
/// A simple, single-threaded event manager that just logs
|
/// A simple, single-threaded event manager that just logs
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct SimpleEventManager<I, ST>
|
pub struct SimpleEventManager<I, MT>
|
||||||
where
|
where
|
||||||
I: Input,
|
I: Input,
|
||||||
ST: Stats, //CE: CustomEvent<I, OT>,
|
MT: Monitor, //CE: CustomEvent<I, OT>,
|
||||||
{
|
{
|
||||||
/// The stats
|
/// The monitor
|
||||||
stats: ST,
|
monitor: MT,
|
||||||
/// The events that happened since the last handle_in_broker
|
/// The events that happened since the last handle_in_broker
|
||||||
events: Vec<Event<I>>,
|
events: Vec<Event<I>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<I, S, ST> EventFirer<I, S> for SimpleEventManager<I, ST>
|
impl<I, MT, S> EventFirer<I, S> for SimpleEventManager<I, MT>
|
||||||
where
|
where
|
||||||
I: Input,
|
I: Input,
|
||||||
ST: Stats, //CE: CustomEvent<I, OT>,
|
MT: Monitor, //CE: CustomEvent<I, OT>,
|
||||||
{
|
{
|
||||||
fn fire(&mut self, _state: &mut S, event: Event<I>) -> Result<(), Error> {
|
fn fire(&mut self, _state: &mut S, event: Event<I>) -> Result<(), Error> {
|
||||||
match Self::handle_in_broker(&mut self.stats, &event)? {
|
match Self::handle_in_broker(&mut self.monitor, &event)? {
|
||||||
BrokerEventResult::Forward => self.events.push(event),
|
BrokerEventResult::Forward => self.events.push(event),
|
||||||
BrokerEventResult::Handled => (),
|
BrokerEventResult::Handled => (),
|
||||||
};
|
};
|
||||||
@ -62,17 +62,17 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<I, S, ST> EventRestarter<S> for SimpleEventManager<I, ST>
|
impl<I, MT, S> EventRestarter<S> for SimpleEventManager<I, MT>
|
||||||
where
|
where
|
||||||
I: Input,
|
I: Input,
|
||||||
ST: Stats, //CE: CustomEvent<I, OT>,
|
MT: Monitor, //CE: CustomEvent<I, OT>,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<E, I, S, ST, Z> EventProcessor<E, I, S, Z> for SimpleEventManager<I, ST>
|
impl<E, I, MT, S, Z> EventProcessor<E, I, S, Z> for SimpleEventManager<I, MT>
|
||||||
where
|
where
|
||||||
I: Input,
|
I: Input,
|
||||||
ST: Stats, //CE: CustomEvent<I, OT>,
|
MT: Monitor, //CE: CustomEvent<I, OT>,
|
||||||
{
|
{
|
||||||
fn process(
|
fn process(
|
||||||
&mut self,
|
&mut self,
|
||||||
@ -89,39 +89,39 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<E, I, S, ST, Z> EventManager<E, I, S, Z> for SimpleEventManager<I, ST>
|
impl<E, I, MT, S, Z> EventManager<E, I, S, Z> for SimpleEventManager<I, MT>
|
||||||
where
|
where
|
||||||
I: Input,
|
I: Input,
|
||||||
ST: Stats, //CE: CustomEvent<I, OT>,
|
MT: Monitor, //CE: CustomEvent<I, OT>,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<I, ST> HasEventManagerId for SimpleEventManager<I, ST>
|
impl<I, MT> HasEventManagerId for SimpleEventManager<I, MT>
|
||||||
where
|
where
|
||||||
I: Input,
|
I: Input,
|
||||||
ST: Stats,
|
MT: Monitor,
|
||||||
{
|
{
|
||||||
fn mgr_id(&self) -> EventManagerId {
|
fn mgr_id(&self) -> EventManagerId {
|
||||||
EventManagerId { id: 0 }
|
EventManagerId { id: 0 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<I, ST> SimpleEventManager<I, ST>
|
impl<I, MT> SimpleEventManager<I, MT>
|
||||||
where
|
where
|
||||||
I: Input,
|
I: Input,
|
||||||
ST: Stats, //TODO CE: CustomEvent,
|
MT: Monitor, //TODO CE: CustomEvent,
|
||||||
{
|
{
|
||||||
/// Creates a new [`SimpleEventManager`].
|
/// Creates a new [`SimpleEventManager`].
|
||||||
pub fn new(stats: ST) -> Self {
|
pub fn new(monitor: MT) -> Self {
|
||||||
Self {
|
Self {
|
||||||
stats,
|
monitor,
|
||||||
events: vec![],
|
events: vec![],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle arriving events in the broker
|
// Handle arriving events in the broker
|
||||||
#[allow(clippy::unnecessary_wraps)]
|
#[allow(clippy::unnecessary_wraps)]
|
||||||
fn handle_in_broker(stats: &mut ST, event: &Event<I>) -> Result<BrokerEventResult, Error> {
|
fn handle_in_broker(monitor: &mut MT, event: &Event<I>) -> Result<BrokerEventResult, Error> {
|
||||||
match event {
|
match event {
|
||||||
Event::NewTestcase {
|
Event::NewTestcase {
|
||||||
input: _,
|
input: _,
|
||||||
@ -132,25 +132,25 @@ where
|
|||||||
time,
|
time,
|
||||||
executions,
|
executions,
|
||||||
} => {
|
} => {
|
||||||
stats
|
monitor
|
||||||
.client_stats_mut_for(0)
|
.client_stats_mut_for(0)
|
||||||
.update_corpus_size(*corpus_size as u64);
|
.update_corpus_size(*corpus_size as u64);
|
||||||
stats
|
monitor
|
||||||
.client_stats_mut_for(0)
|
.client_stats_mut_for(0)
|
||||||
.update_executions(*executions as u64, *time);
|
.update_executions(*executions as u64, *time);
|
||||||
stats.display(event.name().to_string(), 0);
|
monitor.display(event.name().to_string(), 0);
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
}
|
}
|
||||||
Event::UpdateStats {
|
Event::UpdateExecutions {
|
||||||
time,
|
time,
|
||||||
executions,
|
executions,
|
||||||
phantom: _,
|
phantom: _,
|
||||||
} => {
|
} => {
|
||||||
// TODO: The stats buffer should be added on client add.
|
// TODO: The monitor buffer should be added on client add.
|
||||||
stats
|
monitor
|
||||||
.client_stats_mut_for(0)
|
.client_stats_mut_for(0)
|
||||||
.update_executions(*executions as u64, *time);
|
.update_executions(*executions as u64, *time);
|
||||||
stats.display(event.name().to_string(), 0);
|
monitor.display(event.name().to_string(), 0);
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
}
|
}
|
||||||
Event::UpdateUserStats {
|
Event::UpdateUserStats {
|
||||||
@ -158,31 +158,31 @@ where
|
|||||||
value,
|
value,
|
||||||
phantom: _,
|
phantom: _,
|
||||||
} => {
|
} => {
|
||||||
stats
|
monitor
|
||||||
.client_stats_mut_for(0)
|
.client_stats_mut_for(0)
|
||||||
.update_user_stats(name.clone(), value.clone());
|
.update_user_stats(name.clone(), value.clone());
|
||||||
stats.display(event.name().to_string(), 0);
|
monitor.display(event.name().to_string(), 0);
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
}
|
}
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
Event::UpdatePerfStats {
|
Event::UpdatePerfMonitor {
|
||||||
time,
|
time,
|
||||||
executions,
|
executions,
|
||||||
introspection_stats,
|
introspection_monitor,
|
||||||
phantom: _,
|
phantom: _,
|
||||||
} => {
|
} => {
|
||||||
// TODO: The stats buffer should be added on client add.
|
// TODO: The monitor buffer should be added on client add.
|
||||||
stats.client_stats_mut()[0].update_executions(*executions as u64, *time);
|
monitor.client_stats_mut()[0].update_executions(*executions as u64, *time);
|
||||||
stats.client_stats_mut()[0]
|
monitor.client_stats_mut()[0]
|
||||||
.update_introspection_stats((**introspection_stats).clone());
|
.update_introspection_monitor((**introspection_monitor).clone());
|
||||||
stats.display(event.name().to_string(), 0);
|
monitor.display(event.name().to_string(), 0);
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
}
|
}
|
||||||
Event::Objective { objective_size } => {
|
Event::Objective { objective_size } => {
|
||||||
stats
|
monitor
|
||||||
.client_stats_mut_for(0)
|
.client_stats_mut_for(0)
|
||||||
.update_objective_size(*objective_size as u64);
|
.update_objective_size(*objective_size as u64);
|
||||||
stats.display(event.name().to_string(), 0);
|
monitor.display(event.name().to_string(), 0);
|
||||||
Ok(BrokerEventResult::Handled)
|
Ok(BrokerEventResult::Handled)
|
||||||
}
|
}
|
||||||
Event::Log {
|
Event::Log {
|
||||||
@ -213,16 +213,16 @@ where
|
|||||||
/// `restarter` will start a new process each time the child crashes or times out.
|
/// `restarter` will start a new process each time the child crashes or times out.
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
#[allow(clippy::default_trait_access)]
|
#[allow(clippy::default_trait_access)]
|
||||||
pub struct SimpleRestartingEventManager<'a, C, I, S, SC, SP, ST>
|
pub struct SimpleRestartingEventManager<'a, C, I, MT, S, SC, SP>
|
||||||
where
|
where
|
||||||
C: Corpus<I>,
|
C: Corpus<I>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: Serialize,
|
S: Serialize,
|
||||||
SP: ShMemProvider,
|
SP: ShMemProvider,
|
||||||
ST: Stats, //CE: CustomEvent<I, OT>,
|
MT: Monitor, //CE: CustomEvent<I, OT>,
|
||||||
{
|
{
|
||||||
/// The actual simple event mgr
|
/// The actual simple event mgr
|
||||||
simple_event_mgr: SimpleEventManager<I, ST>,
|
simple_event_mgr: SimpleEventManager<I, MT>,
|
||||||
/// [`StateRestorer`] for restarts
|
/// [`StateRestorer`] for restarts
|
||||||
staterestorer: StateRestorer<SP>,
|
staterestorer: StateRestorer<SP>,
|
||||||
/// Phantom data
|
/// Phantom data
|
||||||
@ -230,14 +230,14 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
impl<'a, C, I, S, SC, SP, ST> EventFirer<I, S>
|
impl<'a, C, I, MT, S, SC, SP> EventFirer<I, S>
|
||||||
for SimpleRestartingEventManager<'a, C, I, S, SC, SP, ST>
|
for SimpleRestartingEventManager<'a, C, I, MT, S, SC, SP>
|
||||||
where
|
where
|
||||||
C: Corpus<I>,
|
C: Corpus<I>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: Serialize,
|
S: Serialize,
|
||||||
SP: ShMemProvider,
|
SP: ShMemProvider,
|
||||||
ST: Stats, //CE: CustomEvent<I, OT>,
|
MT: Monitor, //CE: CustomEvent<I, OT>,
|
||||||
{
|
{
|
||||||
fn fire(&mut self, _state: &mut S, event: Event<I>) -> Result<(), Error> {
|
fn fire(&mut self, _state: &mut S, event: Event<I>) -> Result<(), Error> {
|
||||||
self.simple_event_mgr.fire(_state, event)
|
self.simple_event_mgr.fire(_state, event)
|
||||||
@ -245,14 +245,14 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
impl<'a, C, I, S, SC, SP, ST> EventRestarter<S>
|
impl<'a, C, I, MT, S, SC, SP> EventRestarter<S>
|
||||||
for SimpleRestartingEventManager<'a, C, I, S, SC, SP, ST>
|
for SimpleRestartingEventManager<'a, C, I, MT, S, SC, SP>
|
||||||
where
|
where
|
||||||
C: Corpus<I>,
|
C: Corpus<I>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: Serialize,
|
S: Serialize,
|
||||||
SP: ShMemProvider,
|
SP: ShMemProvider,
|
||||||
ST: Stats, //CE: CustomEvent<I, OT>,
|
MT: Monitor, //CE: CustomEvent<I, OT>,
|
||||||
{
|
{
|
||||||
/// Reset the single page (we reuse it over and over from pos 0), then send the current state to the next runner.
|
/// Reset the single page (we reuse it over and over from pos 0), then send the current state to the next runner.
|
||||||
fn on_restart(&mut self, state: &mut S) -> Result<(), Error> {
|
fn on_restart(&mut self, state: &mut S) -> Result<(), Error> {
|
||||||
@ -263,14 +263,14 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
impl<'a, C, E, I, S, SC, SP, ST, Z> EventProcessor<E, I, S, Z>
|
impl<'a, C, E, I, S, SC, SP, MT, Z> EventProcessor<E, I, S, Z>
|
||||||
for SimpleRestartingEventManager<'a, C, I, S, SC, SP, ST>
|
for SimpleRestartingEventManager<'a, C, I, MT, S, SC, SP>
|
||||||
where
|
where
|
||||||
C: Corpus<I>,
|
C: Corpus<I>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: Serialize,
|
S: Serialize,
|
||||||
SP: ShMemProvider,
|
SP: ShMemProvider,
|
||||||
ST: Stats, //CE: CustomEvent<I, OT>,
|
MT: Monitor, //CE: CustomEvent<I, OT>,
|
||||||
{
|
{
|
||||||
fn process(&mut self, fuzzer: &mut Z, state: &mut S, executor: &mut E) -> Result<usize, Error> {
|
fn process(&mut self, fuzzer: &mut Z, state: &mut S, executor: &mut E) -> Result<usize, Error> {
|
||||||
self.simple_event_mgr.process(fuzzer, state, executor)
|
self.simple_event_mgr.process(fuzzer, state, executor)
|
||||||
@ -278,26 +278,26 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
impl<'a, C, E, I, S, SC, SP, ST, Z> EventManager<E, I, S, Z>
|
impl<'a, C, E, I, S, SC, SP, MT, Z> EventManager<E, I, S, Z>
|
||||||
for SimpleRestartingEventManager<'a, C, I, S, SC, SP, ST>
|
for SimpleRestartingEventManager<'a, C, I, MT, S, SC, SP>
|
||||||
where
|
where
|
||||||
C: Corpus<I>,
|
C: Corpus<I>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: Serialize,
|
S: Serialize,
|
||||||
SP: ShMemProvider,
|
SP: ShMemProvider,
|
||||||
ST: Stats, //CE: CustomEvent<I, OT>,
|
MT: Monitor, //CE: CustomEvent<I, OT>,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
impl<'a, C, I, S, SC, SP, ST> HasEventManagerId
|
impl<'a, C, I, MT, S, SC, SP> HasEventManagerId
|
||||||
for SimpleRestartingEventManager<'a, C, I, S, SC, SP, ST>
|
for SimpleRestartingEventManager<'a, C, I, MT, S, SC, SP>
|
||||||
where
|
where
|
||||||
C: Corpus<I>,
|
C: Corpus<I>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: Serialize,
|
S: Serialize,
|
||||||
SP: ShMemProvider,
|
SP: ShMemProvider,
|
||||||
ST: Stats,
|
MT: Monitor,
|
||||||
{
|
{
|
||||||
fn mgr_id(&self) -> EventManagerId {
|
fn mgr_id(&self) -> EventManagerId {
|
||||||
self.simple_event_mgr.mgr_id()
|
self.simple_event_mgr.mgr_id()
|
||||||
@ -306,20 +306,20 @@ where
|
|||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
#[allow(clippy::type_complexity, clippy::too_many_lines)]
|
#[allow(clippy::type_complexity, clippy::too_many_lines)]
|
||||||
impl<'a, C, I, S, SC, SP, ST> SimpleRestartingEventManager<'a, C, I, S, SC, SP, ST>
|
impl<'a, C, I, MT, S, SC, SP> SimpleRestartingEventManager<'a, C, I, MT, S, SC, SP>
|
||||||
where
|
where
|
||||||
C: Corpus<I>,
|
C: Corpus<I>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: DeserializeOwned + Serialize + HasCorpus<C, I> + HasSolutions<SC, I>,
|
S: DeserializeOwned + Serialize + HasCorpus<C, I> + HasSolutions<SC, I>,
|
||||||
SC: Corpus<I>,
|
SC: Corpus<I>,
|
||||||
SP: ShMemProvider,
|
SP: ShMemProvider,
|
||||||
ST: Stats, //TODO CE: CustomEvent,
|
MT: Monitor, //TODO CE: CustomEvent,
|
||||||
{
|
{
|
||||||
/// Creates a new [`SimpleEventManager`].
|
/// Creates a new [`SimpleEventManager`].
|
||||||
fn new_launched(stats: ST, staterestorer: StateRestorer<SP>) -> Self {
|
fn new_launched(monitor: MT, staterestorer: StateRestorer<SP>) -> Self {
|
||||||
Self {
|
Self {
|
||||||
staterestorer,
|
staterestorer,
|
||||||
simple_event_mgr: SimpleEventManager::new(stats),
|
simple_event_mgr: SimpleEventManager::new(monitor),
|
||||||
_phantom: PhantomData {},
|
_phantom: PhantomData {},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -328,7 +328,7 @@ where
|
|||||||
/// This [`EventManager`] is simple and single threaded,
|
/// This [`EventManager`] is simple and single threaded,
|
||||||
/// but can still used shared maps to recover from crashes and timeouts.
|
/// but can still used shared maps to recover from crashes and timeouts.
|
||||||
#[allow(clippy::similar_names)]
|
#[allow(clippy::similar_names)]
|
||||||
pub fn launch(mut stats: ST, shmem_provider: &mut SP) -> Result<(Option<S>, Self), Error> {
|
pub fn launch(mut monitor: MT, shmem_provider: &mut SP) -> Result<(Option<S>, Self), Error> {
|
||||||
// We start ourself as child process to actually fuzz
|
// We start ourself as child process to actually fuzz
|
||||||
let mut staterestorer = if std::env::var(_ENV_FUZZER_SENDER).is_err() {
|
let mut staterestorer = if std::env::var(_ENV_FUZZER_SENDER).is_err() {
|
||||||
// First, create a place to store state in, for restarts.
|
// First, create a place to store state in, for restarts.
|
||||||
@ -397,7 +397,7 @@ where
|
|||||||
// Mgr to send and receive msgs from/to all other fuzzer instances
|
// Mgr to send and receive msgs from/to all other fuzzer instances
|
||||||
(
|
(
|
||||||
None,
|
None,
|
||||||
SimpleRestartingEventManager::new_launched(stats, staterestorer),
|
SimpleRestartingEventManager::new_launched(monitor, staterestorer),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
// Restoring from a previous run, deserialize state and corpus.
|
// Restoring from a previous run, deserialize state and corpus.
|
||||||
@ -406,14 +406,14 @@ where
|
|||||||
// We reset the staterestorer, the next staterestorer and receiver (after crash) will reuse the page from the initial message.
|
// We reset the staterestorer, the next staterestorer and receiver (after crash) will reuse the page from the initial message.
|
||||||
staterestorer.reset();
|
staterestorer.reset();
|
||||||
|
|
||||||
// load the corpus size into stats to still display the correct numbers after restart.
|
// load the corpus size into monitor to still display the correct numbers after restart.
|
||||||
let client_stats = stats.client_stats_mut_for(0);
|
let client_stats = monitor.client_stats_mut_for(0);
|
||||||
client_stats.update_corpus_size(state.corpus().count().try_into()?);
|
client_stats.update_corpus_size(state.corpus().count().try_into()?);
|
||||||
client_stats.update_objective_size(state.solutions().count().try_into()?);
|
client_stats.update_objective_size(state.solutions().count().try_into()?);
|
||||||
|
|
||||||
(
|
(
|
||||||
Some(state),
|
Some(state),
|
||||||
SimpleRestartingEventManager::new_launched(stats, staterestorer),
|
SimpleRestartingEventManager::new_launched(monitor, staterestorer),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -33,7 +33,7 @@ use crate::{
|
|||||||
fuzzer::HasObjective,
|
fuzzer::HasObjective,
|
||||||
inputs::Input,
|
inputs::Input,
|
||||||
observers::ObserversTuple,
|
observers::ObserversTuple,
|
||||||
state::{HasClientPerfStats, HasSolutions},
|
state::{HasClientPerfMonitor, HasSolutions},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -166,7 +166,7 @@ where
|
|||||||
EM: EventFirer<I, S> + EventRestarter<S>,
|
EM: EventFirer<I, S> + EventRestarter<S>,
|
||||||
OC: Corpus<I>,
|
OC: Corpus<I>,
|
||||||
OF: Feedback<I, S>,
|
OF: Feedback<I, S>,
|
||||||
S: HasSolutions<OC, I> + HasClientPerfStats,
|
S: HasSolutions<OC, I> + HasClientPerfMonitor,
|
||||||
Z: HasObjective<I, OF, S>,
|
Z: HasObjective<I, OF, S>,
|
||||||
{
|
{
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
@ -333,7 +333,7 @@ mod unix_signal_handler {
|
|||||||
fuzzer::HasObjective,
|
fuzzer::HasObjective,
|
||||||
inputs::Input,
|
inputs::Input,
|
||||||
observers::ObserversTuple,
|
observers::ObserversTuple,
|
||||||
state::{HasClientPerfStats, HasMetadata, HasSolutions},
|
state::{HasClientPerfMonitor, HasMetadata, HasSolutions},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub type HandlerFuncPtr =
|
pub type HandlerFuncPtr =
|
||||||
@ -397,7 +397,7 @@ mod unix_signal_handler {
|
|||||||
OT: ObserversTuple<I, S>,
|
OT: ObserversTuple<I, S>,
|
||||||
OC: Corpus<I>,
|
OC: Corpus<I>,
|
||||||
OF: Feedback<I, S>,
|
OF: Feedback<I, S>,
|
||||||
S: HasSolutions<OC, I> + HasClientPerfStats,
|
S: HasSolutions<OC, I> + HasClientPerfMonitor,
|
||||||
I: Input,
|
I: Input,
|
||||||
Z: HasObjective<I, OF, S>,
|
Z: HasObjective<I, OF, S>,
|
||||||
{
|
{
|
||||||
@ -475,7 +475,7 @@ mod unix_signal_handler {
|
|||||||
OT: ObserversTuple<I, S>,
|
OT: ObserversTuple<I, S>,
|
||||||
OC: Corpus<I>,
|
OC: Corpus<I>,
|
||||||
OF: Feedback<I, S>,
|
OF: Feedback<I, S>,
|
||||||
S: HasSolutions<OC, I> + HasClientPerfStats,
|
S: HasSolutions<OC, I> + HasClientPerfMonitor,
|
||||||
I: Input,
|
I: Input,
|
||||||
Z: HasObjective<I, OF, S>,
|
Z: HasObjective<I, OF, S>,
|
||||||
{
|
{
|
||||||
@ -608,7 +608,7 @@ mod windows_exception_handler {
|
|||||||
fuzzer::HasObjective,
|
fuzzer::HasObjective,
|
||||||
inputs::Input,
|
inputs::Input,
|
||||||
observers::ObserversTuple,
|
observers::ObserversTuple,
|
||||||
state::{HasClientPerfStats, HasMetadata, HasSolutions},
|
state::{HasClientPerfMonitor, HasMetadata, HasSolutions},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub type HandlerFuncPtr =
|
pub type HandlerFuncPtr =
|
||||||
@ -647,7 +647,7 @@ mod windows_exception_handler {
|
|||||||
OT: ObserversTuple<I, S>,
|
OT: ObserversTuple<I, S>,
|
||||||
OC: Corpus<I>,
|
OC: Corpus<I>,
|
||||||
OF: Feedback<I, S>,
|
OF: Feedback<I, S>,
|
||||||
S: HasSolutions<OC, I> + HasClientPerfStats,
|
S: HasSolutions<OC, I> + HasClientPerfMonitor,
|
||||||
I: Input,
|
I: Input,
|
||||||
Z: HasObjective<I, OF, S>,
|
Z: HasObjective<I, OF, S>,
|
||||||
{
|
{
|
||||||
@ -723,7 +723,7 @@ mod windows_exception_handler {
|
|||||||
OT: ObserversTuple<I, S>,
|
OT: ObserversTuple<I, S>,
|
||||||
OC: Corpus<I>,
|
OC: Corpus<I>,
|
||||||
OF: Feedback<I, S>,
|
OF: Feedback<I, S>,
|
||||||
S: HasSolutions<OC, I> + HasClientPerfStats,
|
S: HasSolutions<OC, I> + HasClientPerfMonitor,
|
||||||
I: Input,
|
I: Input,
|
||||||
Z: HasObjective<I, OF, S>,
|
Z: HasObjective<I, OF, S>,
|
||||||
{
|
{
|
||||||
@ -920,7 +920,7 @@ where
|
|||||||
EM: EventFirer<I, S> + EventRestarter<S>,
|
EM: EventFirer<I, S> + EventRestarter<S>,
|
||||||
OC: Corpus<I>,
|
OC: Corpus<I>,
|
||||||
OF: Feedback<I, S>,
|
OF: Feedback<I, S>,
|
||||||
S: HasSolutions<OC, I> + HasClientPerfStats,
|
S: HasSolutions<OC, I> + HasClientPerfMonitor,
|
||||||
Z: HasObjective<I, OF, S>,
|
Z: HasObjective<I, OF, S>,
|
||||||
{
|
{
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
|
@ -9,7 +9,7 @@ use crate::{
|
|||||||
concolic::{ConcolicMetadata, ConcolicObserver},
|
concolic::{ConcolicMetadata, ConcolicObserver},
|
||||||
ObserversTuple,
|
ObserversTuple,
|
||||||
},
|
},
|
||||||
state::{HasClientPerfStats, HasMetadata},
|
state::{HasClientPerfMonitor, HasMetadata},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ impl Named for ConcolicFeedback {
|
|||||||
impl<I, S> Feedback<I, S> for ConcolicFeedback
|
impl<I, S> Feedback<I, S> for ConcolicFeedback
|
||||||
where
|
where
|
||||||
I: Input,
|
I: Input,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
fn is_interesting<EM, OT>(
|
fn is_interesting<EM, OT>(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
@ -15,9 +15,9 @@ use crate::{
|
|||||||
executors::ExitKind,
|
executors::ExitKind,
|
||||||
feedbacks::{Feedback, FeedbackState, FeedbackStatesTuple},
|
feedbacks::{Feedback, FeedbackState, FeedbackStatesTuple},
|
||||||
inputs::Input,
|
inputs::Input,
|
||||||
|
monitors::UserStats,
|
||||||
observers::{MapObserver, ObserversTuple},
|
observers::{MapObserver, ObserversTuple},
|
||||||
state::{HasClientPerfStats, HasFeedbackStates, HasMetadata},
|
state::{HasClientPerfMonitor, HasFeedbackStates, HasMetadata},
|
||||||
stats::UserStats,
|
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -324,7 +324,7 @@ where
|
|||||||
O: MapObserver<T>,
|
O: MapObserver<T>,
|
||||||
MF: MapFindFilter<T>,
|
MF: MapFindFilter<T>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: HasFeedbackStates<FT> + HasClientPerfStats,
|
S: HasFeedbackStates<FT> + HasClientPerfMonitor,
|
||||||
FT: FeedbackStatesTuple,
|
FT: FeedbackStatesTuple,
|
||||||
{
|
{
|
||||||
fn is_interesting<EM, OT>(
|
fn is_interesting<EM, OT>(
|
||||||
@ -552,7 +552,7 @@ impl<I, O, S> Feedback<I, S> for ReachabilityFeedback<O>
|
|||||||
where
|
where
|
||||||
I: Input,
|
I: Input,
|
||||||
O: MapObserver<usize>,
|
O: MapObserver<usize>,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
fn is_interesting<EM, OT>(
|
fn is_interesting<EM, OT>(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
@ -24,7 +24,7 @@ use crate::{
|
|||||||
executors::ExitKind,
|
executors::ExitKind,
|
||||||
inputs::Input,
|
inputs::Input,
|
||||||
observers::{ObserversTuple, TimeObserver},
|
observers::{ObserversTuple, TimeObserver},
|
||||||
state::HasClientPerfStats,
|
state::HasClientPerfMonitor,
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ use core::{marker::PhantomData, time::Duration};
|
|||||||
pub trait Feedback<I, S>: Named
|
pub trait Feedback<I, S>: Named
|
||||||
where
|
where
|
||||||
I: Input,
|
I: Input,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
/// `is_interesting ` return if an input is worth the addition to the corpus
|
/// `is_interesting ` return if an input is worth the addition to the corpus
|
||||||
fn is_interesting<EM, OT>(
|
fn is_interesting<EM, OT>(
|
||||||
@ -76,7 +76,7 @@ where
|
|||||||
|
|
||||||
// Add this stat to the feedback metrics
|
// Add this stat to the feedback metrics
|
||||||
state
|
state
|
||||||
.introspection_stats_mut()
|
.introspection_monitor_mut()
|
||||||
.update_feedback(self.name(), elapsed);
|
.update_feedback(self.name(), elapsed);
|
||||||
|
|
||||||
ret
|
ret
|
||||||
@ -136,7 +136,7 @@ where
|
|||||||
B: Feedback<I, S>,
|
B: Feedback<I, S>,
|
||||||
FL: FeedbackLogic<A, B, I, S>,
|
FL: FeedbackLogic<A, B, I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
pub first: A,
|
pub first: A,
|
||||||
pub second: B,
|
pub second: B,
|
||||||
@ -150,7 +150,7 @@ where
|
|||||||
B: Feedback<I, S>,
|
B: Feedback<I, S>,
|
||||||
FL: FeedbackLogic<A, B, I, S>,
|
FL: FeedbackLogic<A, B, I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
self.name.as_ref()
|
self.name.as_ref()
|
||||||
@ -163,7 +163,7 @@ where
|
|||||||
B: Feedback<I, S>,
|
B: Feedback<I, S>,
|
||||||
FL: FeedbackLogic<A, B, I, S>,
|
FL: FeedbackLogic<A, B, I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
pub fn new(first: A, second: B) -> Self {
|
pub fn new(first: A, second: B) -> Self {
|
||||||
let name = format!("{} ({},{})", FL::name(), first.name(), second.name());
|
let name = format!("{} ({},{})", FL::name(), first.name(), second.name());
|
||||||
@ -182,7 +182,7 @@ where
|
|||||||
B: Feedback<I, S>,
|
B: Feedback<I, S>,
|
||||||
FL: FeedbackLogic<A, B, I, S>,
|
FL: FeedbackLogic<A, B, I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
fn is_interesting<EM, OT>(
|
fn is_interesting<EM, OT>(
|
||||||
&mut self,
|
&mut self,
|
||||||
@ -249,7 +249,7 @@ where
|
|||||||
A: Feedback<I, S>,
|
A: Feedback<I, S>,
|
||||||
B: Feedback<I, S>,
|
B: Feedback<I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
fn name() -> &'static str;
|
fn name() -> &'static str;
|
||||||
|
|
||||||
@ -292,7 +292,7 @@ where
|
|||||||
A: Feedback<I, S>,
|
A: Feedback<I, S>,
|
||||||
B: Feedback<I, S>,
|
B: Feedback<I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
fn name() -> &'static str {
|
fn name() -> &'static str {
|
||||||
"Eager OR"
|
"Eager OR"
|
||||||
@ -343,7 +343,7 @@ where
|
|||||||
A: Feedback<I, S>,
|
A: Feedback<I, S>,
|
||||||
B: Feedback<I, S>,
|
B: Feedback<I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
fn name() -> &'static str {
|
fn name() -> &'static str {
|
||||||
"Fast OR"
|
"Fast OR"
|
||||||
@ -400,7 +400,7 @@ where
|
|||||||
A: Feedback<I, S>,
|
A: Feedback<I, S>,
|
||||||
B: Feedback<I, S>,
|
B: Feedback<I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
fn name() -> &'static str {
|
fn name() -> &'static str {
|
||||||
"Eager AND"
|
"Eager AND"
|
||||||
@ -451,7 +451,7 @@ where
|
|||||||
A: Feedback<I, S>,
|
A: Feedback<I, S>,
|
||||||
B: Feedback<I, S>,
|
B: Feedback<I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
fn name() -> &'static str {
|
fn name() -> &'static str {
|
||||||
"Fast AND"
|
"Fast AND"
|
||||||
@ -526,7 +526,7 @@ pub struct NotFeedback<A, I, S>
|
|||||||
where
|
where
|
||||||
A: Feedback<I, S>,
|
A: Feedback<I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
/// The feedback to invert
|
/// The feedback to invert
|
||||||
pub first: A,
|
pub first: A,
|
||||||
@ -539,7 +539,7 @@ impl<A, I, S> Feedback<I, S> for NotFeedback<A, I, S>
|
|||||||
where
|
where
|
||||||
A: Feedback<I, S>,
|
A: Feedback<I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
fn is_interesting<EM, OT>(
|
fn is_interesting<EM, OT>(
|
||||||
&mut self,
|
&mut self,
|
||||||
@ -573,7 +573,7 @@ impl<A, I, S> Named for NotFeedback<A, I, S>
|
|||||||
where
|
where
|
||||||
A: Feedback<I, S>,
|
A: Feedback<I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
fn name(&self) -> &str {
|
fn name(&self) -> &str {
|
||||||
@ -585,7 +585,7 @@ impl<A, I, S> NotFeedback<A, I, S>
|
|||||||
where
|
where
|
||||||
A: Feedback<I, S>,
|
A: Feedback<I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
/// Creates a new [`NotFeedback`].
|
/// Creates a new [`NotFeedback`].
|
||||||
pub fn new(first: A) -> Self {
|
pub fn new(first: A) -> Self {
|
||||||
@ -653,7 +653,7 @@ macro_rules! feedback_not {
|
|||||||
impl<I, S> Feedback<I, S> for ()
|
impl<I, S> Feedback<I, S> for ()
|
||||||
where
|
where
|
||||||
I: Input,
|
I: Input,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
fn is_interesting<EM, OT>(
|
fn is_interesting<EM, OT>(
|
||||||
&mut self,
|
&mut self,
|
||||||
@ -685,7 +685,7 @@ pub struct CrashFeedback {}
|
|||||||
impl<I, S> Feedback<I, S> for CrashFeedback
|
impl<I, S> Feedback<I, S> for CrashFeedback
|
||||||
where
|
where
|
||||||
I: Input,
|
I: Input,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
fn is_interesting<EM, OT>(
|
fn is_interesting<EM, OT>(
|
||||||
&mut self,
|
&mut self,
|
||||||
@ -735,7 +735,7 @@ pub struct TimeoutFeedback {}
|
|||||||
impl<I, S> Feedback<I, S> for TimeoutFeedback
|
impl<I, S> Feedback<I, S> for TimeoutFeedback
|
||||||
where
|
where
|
||||||
I: Input,
|
I: Input,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
fn is_interesting<EM, OT>(
|
fn is_interesting<EM, OT>(
|
||||||
&mut self,
|
&mut self,
|
||||||
@ -790,7 +790,7 @@ pub struct TimeFeedback {
|
|||||||
impl<I, S> Feedback<I, S> for TimeFeedback
|
impl<I, S> Feedback<I, S> for TimeFeedback
|
||||||
where
|
where
|
||||||
I: Input,
|
I: Input,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
fn is_interesting<EM, OT>(
|
fn is_interesting<EM, OT>(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
@ -11,7 +11,7 @@ use crate::{
|
|||||||
generators::NautilusContext,
|
generators::NautilusContext,
|
||||||
inputs::NautilusInput,
|
inputs::NautilusInput,
|
||||||
observers::ObserversTuple,
|
observers::ObserversTuple,
|
||||||
state::{HasClientPerfStats, HasMetadata},
|
state::{HasClientPerfMonitor, HasMetadata},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ impl<'a> Named for NautilusFeedback<'a> {
|
|||||||
|
|
||||||
impl<'a, S> Feedback<NautilusInput, S> for NautilusFeedback<'a>
|
impl<'a, S> Feedback<NautilusInput, S> for NautilusFeedback<'a>
|
||||||
where
|
where
|
||||||
S: HasMetadata + HasClientPerfStats,
|
S: HasMetadata + HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
fn is_interesting<EM, OT>(
|
fn is_interesting<EM, OT>(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
@ -11,19 +11,19 @@ use crate::{
|
|||||||
observers::ObserversTuple,
|
observers::ObserversTuple,
|
||||||
stages::StagesTuple,
|
stages::StagesTuple,
|
||||||
start_timer,
|
start_timer,
|
||||||
state::{HasClientPerfStats, HasCorpus, HasExecutions, HasSolutions},
|
state::{HasClientPerfMonitor, HasCorpus, HasExecutions, HasSolutions},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
use crate::stats::PerfFeature;
|
use crate::monitors::PerfFeature;
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
use alloc::boxed::Box;
|
use alloc::boxed::Box;
|
||||||
|
|
||||||
use alloc::string::ToString;
|
use alloc::string::ToString;
|
||||||
use core::{marker::PhantomData, time::Duration};
|
use core::{marker::PhantomData, time::Duration};
|
||||||
|
|
||||||
/// Send a stats update all 15 (or more) seconds
|
/// Send a monitor update all 15 (or more) seconds
|
||||||
const STATS_TIMEOUT_DEFAULT: Duration = Duration::from_secs(15);
|
const STATS_TIMEOUT_DEFAULT: Duration = Duration::from_secs(15);
|
||||||
|
|
||||||
/// Holds a scheduler
|
/// Holds a scheduler
|
||||||
@ -44,7 +44,7 @@ pub trait HasFeedback<F, I, S>
|
|||||||
where
|
where
|
||||||
F: Feedback<I, S>,
|
F: Feedback<I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
/// The feedback
|
/// The feedback
|
||||||
fn feedback(&self) -> &F;
|
fn feedback(&self) -> &F;
|
||||||
@ -58,7 +58,7 @@ pub trait HasObjective<I, OF, S>
|
|||||||
where
|
where
|
||||||
OF: Feedback<I, S>,
|
OF: Feedback<I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
/// The objective feedback
|
/// The objective feedback
|
||||||
fn objective(&self) -> &OF;
|
fn objective(&self) -> &OF;
|
||||||
@ -172,10 +172,10 @@ pub trait Fuzzer<E, EM, I, S, ST> {
|
|||||||
manager: &mut EM,
|
manager: &mut EM,
|
||||||
) -> Result<usize, Error> {
|
) -> Result<usize, Error> {
|
||||||
let mut last = current_time();
|
let mut last = current_time();
|
||||||
let stats_timeout = STATS_TIMEOUT_DEFAULT;
|
let monitor_timeout = STATS_TIMEOUT_DEFAULT;
|
||||||
loop {
|
loop {
|
||||||
self.fuzz_one(stages, executor, state, manager)?;
|
self.fuzz_one(stages, executor, state, manager)?;
|
||||||
last = Self::maybe_report_stats(state, manager, last, stats_timeout)?;
|
last = Self::maybe_report_monitor(state, manager, last, monitor_timeout)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,11 +201,11 @@ pub trait Fuzzer<E, EM, I, S, ST> {
|
|||||||
|
|
||||||
let mut ret = 0;
|
let mut ret = 0;
|
||||||
let mut last = current_time();
|
let mut last = current_time();
|
||||||
let stats_timeout = STATS_TIMEOUT_DEFAULT;
|
let monitor_timeout = STATS_TIMEOUT_DEFAULT;
|
||||||
|
|
||||||
for _ in 0..iters {
|
for _ in 0..iters {
|
||||||
ret = self.fuzz_one(stages, executor, state, manager)?;
|
ret = self.fuzz_one(stages, executor, state, manager)?;
|
||||||
last = Self::maybe_report_stats(state, manager, last, stats_timeout)?;
|
last = Self::maybe_report_monitor(state, manager, last, monitor_timeout)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we would assume the fuzzer loop will always exit after this, we could do this here:
|
// If we would assume the fuzzer loop will always exit after this, we could do this here:
|
||||||
@ -216,14 +216,14 @@ pub trait Fuzzer<E, EM, I, S, ST> {
|
|||||||
Ok(ret)
|
Ok(ret)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Given the last time, if `stats_timeout` seconds passed, send off an info/stats/heartbeat message to the broker.
|
/// Given the last time, if `monitor_timeout` seconds passed, send off an info/monitor/heartbeat message to the broker.
|
||||||
/// Returns the new `last` time (so the old one, unless `stats_timeout` time has passed and stats have been sent)
|
/// Returns the new `last` time (so the old one, unless `monitor_timeout` time has passed and monitor have been sent)
|
||||||
/// Will return an [`crate::Error`], if the stats could not be sent.
|
/// Will return an [`crate::Error`], if the monitor could not be sent.
|
||||||
fn maybe_report_stats(
|
fn maybe_report_monitor(
|
||||||
state: &mut S,
|
state: &mut S,
|
||||||
manager: &mut EM,
|
manager: &mut EM,
|
||||||
last: Duration,
|
last: Duration,
|
||||||
stats_timeout: Duration,
|
monitor_timeout: Duration,
|
||||||
) -> Result<Duration, Error>;
|
) -> Result<Duration, Error>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,7 +242,7 @@ where
|
|||||||
F: Feedback<I, S>,
|
F: Feedback<I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
OF: Feedback<I, S>,
|
OF: Feedback<I, S>,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
scheduler: CS,
|
scheduler: CS,
|
||||||
feedback: F,
|
feedback: F,
|
||||||
@ -257,7 +257,7 @@ where
|
|||||||
F: Feedback<I, S>,
|
F: Feedback<I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
OF: Feedback<I, S>,
|
OF: Feedback<I, S>,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
fn scheduler(&self) -> &CS {
|
fn scheduler(&self) -> &CS {
|
||||||
&self.scheduler
|
&self.scheduler
|
||||||
@ -274,7 +274,7 @@ where
|
|||||||
F: Feedback<I, S>,
|
F: Feedback<I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
OF: Feedback<I, S>,
|
OF: Feedback<I, S>,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
fn feedback(&self) -> &F {
|
fn feedback(&self) -> &F {
|
||||||
&self.feedback
|
&self.feedback
|
||||||
@ -291,7 +291,7 @@ where
|
|||||||
F: Feedback<I, S>,
|
F: Feedback<I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
OF: Feedback<I, S>,
|
OF: Feedback<I, S>,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
fn objective(&self) -> &OF {
|
fn objective(&self) -> &OF {
|
||||||
&self.objective
|
&self.objective
|
||||||
@ -312,7 +312,7 @@ where
|
|||||||
I: Input,
|
I: Input,
|
||||||
OF: Feedback<I, S>,
|
OF: Feedback<I, S>,
|
||||||
OT: ObserversTuple<I, S> + serde::Serialize + serde::de::DeserializeOwned,
|
OT: ObserversTuple<I, S> + serde::Serialize + serde::de::DeserializeOwned,
|
||||||
S: HasCorpus<C, I> + HasSolutions<SC, I> + HasClientPerfStats + HasExecutions,
|
S: HasCorpus<C, I> + HasSolutions<SC, I> + HasClientPerfMonitor + HasExecutions,
|
||||||
{
|
{
|
||||||
/// Evaluate if a set of observation channels has an interesting state
|
/// Evaluate if a set of observation channels has an interesting state
|
||||||
fn process_execution<EM>(
|
fn process_execution<EM>(
|
||||||
@ -428,7 +428,7 @@ where
|
|||||||
F: Feedback<I, S>,
|
F: Feedback<I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
OF: Feedback<I, S>,
|
OF: Feedback<I, S>,
|
||||||
S: HasExecutions + HasCorpus<C, I> + HasSolutions<SC, I> + HasClientPerfStats,
|
S: HasExecutions + HasCorpus<C, I> + HasSolutions<SC, I> + HasClientPerfMonitor,
|
||||||
SC: Corpus<I>,
|
SC: Corpus<I>,
|
||||||
{
|
{
|
||||||
/// Process one input, adding to the respective corpuses if needed and firing the right events
|
/// Process one input, adding to the respective corpuses if needed and firing the right events
|
||||||
@ -462,7 +462,7 @@ where
|
|||||||
F: Feedback<I, S>,
|
F: Feedback<I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
OF: Feedback<I, S>,
|
OF: Feedback<I, S>,
|
||||||
S: HasExecutions + HasCorpus<C, I> + HasSolutions<SC, I> + HasClientPerfStats,
|
S: HasExecutions + HasCorpus<C, I> + HasSolutions<SC, I> + HasClientPerfMonitor,
|
||||||
SC: Corpus<I>,
|
SC: Corpus<I>,
|
||||||
{
|
{
|
||||||
/// Process one input, adding to the respective corpuses if needed and firing the right events
|
/// Process one input, adding to the respective corpuses if needed and firing the right events
|
||||||
@ -527,46 +527,46 @@ where
|
|||||||
EM: EventManager<E, I, S, Self>,
|
EM: EventManager<E, I, S, Self>,
|
||||||
F: Feedback<I, S>,
|
F: Feedback<I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: HasExecutions + HasClientPerfStats,
|
S: HasExecutions + HasClientPerfMonitor,
|
||||||
OF: Feedback<I, S>,
|
OF: Feedback<I, S>,
|
||||||
ST: StagesTuple<E, EM, S, Self>,
|
ST: StagesTuple<E, EM, S, Self>,
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
fn maybe_report_stats(
|
fn maybe_report_monitor(
|
||||||
state: &mut S,
|
state: &mut S,
|
||||||
manager: &mut EM,
|
manager: &mut EM,
|
||||||
last: Duration,
|
last: Duration,
|
||||||
stats_timeout: Duration,
|
monitor_timeout: Duration,
|
||||||
) -> Result<Duration, Error> {
|
) -> Result<Duration, Error> {
|
||||||
let cur = current_time();
|
let cur = current_time();
|
||||||
// default to 0 here to avoid crashes on clock skew
|
// default to 0 here to avoid crashes on clock skew
|
||||||
if cur.checked_sub(last).unwrap_or_default() > stats_timeout {
|
if cur.checked_sub(last).unwrap_or_default() > monitor_timeout {
|
||||||
// Default no introspection implmentation
|
// Default no introspection implmentation
|
||||||
#[cfg(not(feature = "introspection"))]
|
#[cfg(not(feature = "introspection"))]
|
||||||
manager.fire(
|
manager.fire(
|
||||||
state,
|
state,
|
||||||
Event::UpdateStats {
|
Event::UpdateExecutions {
|
||||||
executions: *state.executions(),
|
executions: *state.executions(),
|
||||||
time: cur,
|
time: cur,
|
||||||
phantom: PhantomData,
|
phantom: PhantomData,
|
||||||
},
|
},
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
// If performance stats are requested, fire the `UpdatePerfStats` event
|
// If performance monitor are requested, fire the `UpdatePerfMonitor` event
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
{
|
{
|
||||||
state
|
state
|
||||||
.introspection_stats_mut()
|
.introspection_monitor_mut()
|
||||||
.set_current_time(crate::bolts::cpu::read_time_counter());
|
.set_current_time(crate::bolts::cpu::read_time_counter());
|
||||||
|
|
||||||
// Send the current stats over to the manager. This `.clone` shouldn't be
|
// Send the current monitor over to the manager. This `.clone` shouldn't be
|
||||||
// costly as `ClientPerfStats` impls `Copy` since it only contains `u64`s
|
// costly as `ClientPerfMonitor` impls `Copy` since it only contains `u64`s
|
||||||
manager.fire(
|
manager.fire(
|
||||||
state,
|
state,
|
||||||
Event::UpdatePerfStats {
|
Event::UpdatePerfMonitor {
|
||||||
executions: *state.executions(),
|
executions: *state.executions(),
|
||||||
time: cur,
|
time: cur,
|
||||||
introspection_stats: Box::new(state.introspection_stats().clone()),
|
introspection_monitor: Box::new(state.introspection_monitor().clone()),
|
||||||
phantom: PhantomData,
|
phantom: PhantomData,
|
||||||
},
|
},
|
||||||
)?;
|
)?;
|
||||||
@ -588,32 +588,32 @@ where
|
|||||||
) -> Result<usize, Error> {
|
) -> Result<usize, Error> {
|
||||||
// Init timer for scheduler
|
// Init timer for scheduler
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
state.introspection_stats_mut().start_timer();
|
state.introspection_monitor_mut().start_timer();
|
||||||
|
|
||||||
// Get the next index from the scheduler
|
// Get the next index from the scheduler
|
||||||
let idx = self.scheduler.next(state)?;
|
let idx = self.scheduler.next(state)?;
|
||||||
|
|
||||||
// Mark the elapsed time for the scheduler
|
// Mark the elapsed time for the scheduler
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
state.introspection_stats_mut().mark_scheduler_time();
|
state.introspection_monitor_mut().mark_scheduler_time();
|
||||||
|
|
||||||
// Mark the elapsed time for the scheduler
|
// Mark the elapsed time for the scheduler
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
state.introspection_stats_mut().reset_stage_index();
|
state.introspection_monitor_mut().reset_stage_index();
|
||||||
|
|
||||||
// Execute all stages
|
// Execute all stages
|
||||||
stages.perform_all(self, executor, state, manager, idx)?;
|
stages.perform_all(self, executor, state, manager, idx)?;
|
||||||
|
|
||||||
// Init timer for manager
|
// Init timer for manager
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
state.introspection_stats_mut().start_timer();
|
state.introspection_monitor_mut().start_timer();
|
||||||
|
|
||||||
// Execute the manager
|
// Execute the manager
|
||||||
manager.process(self, state, executor)?;
|
manager.process(self, state, executor)?;
|
||||||
|
|
||||||
// Mark the elapsed time for the manager
|
// Mark the elapsed time for the manager
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
state.introspection_stats_mut().mark_manager_time();
|
state.introspection_monitor_mut().mark_manager_time();
|
||||||
|
|
||||||
Ok(idx)
|
Ok(idx)
|
||||||
}
|
}
|
||||||
@ -625,7 +625,7 @@ where
|
|||||||
F: Feedback<I, S>,
|
F: Feedback<I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
OF: Feedback<I, S>,
|
OF: Feedback<I, S>,
|
||||||
S: HasExecutions + HasClientPerfStats,
|
S: HasExecutions + HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
/// Create a new `StdFuzzer` with standard behavior.
|
/// Create a new `StdFuzzer` with standard behavior.
|
||||||
pub fn new(scheduler: CS, feedback: F, objective: OF) -> Self {
|
pub fn new(scheduler: CS, feedback: F, objective: OF) -> Self {
|
||||||
|
@ -31,15 +31,36 @@ pub mod executors;
|
|||||||
pub mod feedbacks;
|
pub mod feedbacks;
|
||||||
pub mod generators;
|
pub mod generators;
|
||||||
pub mod inputs;
|
pub mod inputs;
|
||||||
|
pub mod monitors;
|
||||||
pub mod mutators;
|
pub mod mutators;
|
||||||
pub mod observers;
|
pub mod observers;
|
||||||
pub mod stages;
|
pub mod stages;
|
||||||
pub mod state;
|
pub mod state;
|
||||||
pub mod stats;
|
|
||||||
|
|
||||||
pub mod fuzzer;
|
pub mod fuzzer;
|
||||||
pub use fuzzer::*;
|
pub use fuzzer::*;
|
||||||
|
|
||||||
|
/// The `stats` module got renamed to [`monitors`].
|
||||||
|
/// It monitors and displays the statistics of the fuzzing process.
|
||||||
|
#[deprecated(since = "0.6.0", note = "The `stats` module got renamed to `monitors`")]
|
||||||
|
pub mod stats {
|
||||||
|
#[deprecated(
|
||||||
|
since = "0.6.0",
|
||||||
|
note = "Use monitors::MultiMonitor instead of stats::MultiStats!"
|
||||||
|
)]
|
||||||
|
pub use crate::monitors::MultiMonitor as MultiStats;
|
||||||
|
#[deprecated(
|
||||||
|
since = "0.6.0",
|
||||||
|
note = "Use monitors::SimpleMonitor instead of stats::SimpleStats!"
|
||||||
|
)]
|
||||||
|
pub use crate::monitors::SimpleMonitor as SimpleStats;
|
||||||
|
#[deprecated(
|
||||||
|
since = "0.6.0",
|
||||||
|
note = "Use monitors::UserMonitor instead of stats::SimpleStats!"
|
||||||
|
)]
|
||||||
|
pub use crate::monitors::UserStats;
|
||||||
|
}
|
||||||
|
|
||||||
use alloc::string::String;
|
use alloc::string::String;
|
||||||
use core::fmt;
|
use core::fmt;
|
||||||
|
|
||||||
@ -173,10 +194,10 @@ mod tests {
|
|||||||
corpus::{Corpus, InMemoryCorpus, RandCorpusScheduler, Testcase},
|
corpus::{Corpus, InMemoryCorpus, RandCorpusScheduler, Testcase},
|
||||||
executors::{ExitKind, InProcessExecutor},
|
executors::{ExitKind, InProcessExecutor},
|
||||||
inputs::BytesInput,
|
inputs::BytesInput,
|
||||||
|
monitors::SimpleMonitor,
|
||||||
mutators::{mutations::BitFlipMutator, StdScheduledMutator},
|
mutators::{mutations::BitFlipMutator, StdScheduledMutator},
|
||||||
stages::StdMutationalStage,
|
stages::StdMutationalStage,
|
||||||
state::{HasCorpus, StdState},
|
state::{HasCorpus, StdState},
|
||||||
stats::SimpleStats,
|
|
||||||
Fuzzer, StdFuzzer,
|
Fuzzer, StdFuzzer,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -199,10 +220,10 @@ mod tests {
|
|||||||
tuple_list!(),
|
tuple_list!(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let stats = SimpleStats::new(|s| {
|
let monitor = SimpleMonitor::new(|s| {
|
||||||
println!("{}", s);
|
println!("{}", s);
|
||||||
});
|
});
|
||||||
let mut event_manager = SimpleEventManager::new(stats);
|
let mut event_manager = SimpleEventManager::new(monitor);
|
||||||
|
|
||||||
let scheduler = RandCorpusScheduler::new();
|
let scheduler = RandCorpusScheduler::new();
|
||||||
let mut fuzzer = StdFuzzer::new(scheduler, (), ());
|
let mut fuzzer = StdFuzzer::new(scheduler, (), ());
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
//! Keep stats, and dispaly them to the user. Usually used in a broker, or main node, of some sort.
|
//! Keep stats, and dispaly them to the user. Usually used in a broker, or main node, of some sort.
|
||||||
|
|
||||||
pub mod multi;
|
pub mod multi;
|
||||||
pub use multi::MultiStats;
|
pub use multi::MultiMonitor;
|
||||||
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
@ -17,7 +17,7 @@ use crate::bolts::current_time;
|
|||||||
|
|
||||||
const CLIENT_STATS_TIME_WINDOW_SECS: u64 = 5; // 5 seconds
|
const CLIENT_STATS_TIME_WINDOW_SECS: u64 = 5; // 5 seconds
|
||||||
|
|
||||||
/// User-defined stats types
|
/// User-defined stat types
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||||
pub enum UserStats {
|
pub enum UserStats {
|
||||||
Number(u64),
|
Number(u64),
|
||||||
@ -41,10 +41,10 @@ impl fmt::Display for UserStats {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// A simple struct to keep track of client stats
|
/// A simple struct to keep track of client monitor
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
pub struct ClientStats {
|
pub struct ClientStats {
|
||||||
// stats (maybe we need a separated struct?)
|
// monitor (maybe we need a separated struct?)
|
||||||
/// The corpus size for this client
|
/// The corpus size for this client
|
||||||
pub corpus_size: u64,
|
pub corpus_size: u64,
|
||||||
/// The total executions for this client
|
/// The total executions for this client
|
||||||
@ -57,12 +57,12 @@ pub struct ClientStats {
|
|||||||
pub last_window_time: time::Duration,
|
pub last_window_time: time::Duration,
|
||||||
/// The last executions per sec
|
/// The last executions per sec
|
||||||
pub last_execs_per_sec: f32,
|
pub last_execs_per_sec: f32,
|
||||||
/// User-defined stats
|
/// User-defined monitor
|
||||||
pub user_stats: HashMap<String, UserStats>,
|
pub user_monitor: HashMap<String, UserStats>,
|
||||||
|
|
||||||
/// Client performance statistics
|
/// Client performance statistics
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
pub introspection_stats: ClientPerfStats,
|
pub introspection_monitor: ClientPerfMonitor,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ClientStats {
|
impl ClientStats {
|
||||||
@ -121,33 +121,33 @@ impl ClientStats {
|
|||||||
|
|
||||||
/// Update the user-defined stat with name and value
|
/// Update the user-defined stat with name and value
|
||||||
pub fn update_user_stats(&mut self, name: String, value: UserStats) {
|
pub fn update_user_stats(&mut self, name: String, value: UserStats) {
|
||||||
self.user_stats.insert(name, value);
|
self.user_monitor.insert(name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get a user-defined stat using the name
|
/// Get a user-defined stat using the name
|
||||||
pub fn get_user_stats(&mut self, name: &str) -> Option<&UserStats> {
|
pub fn get_user_stats(&mut self, name: &str) -> Option<&UserStats> {
|
||||||
self.user_stats.get(name)
|
self.user_monitor.get(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Update the current [`ClientPerfStats`] with the given [`ClientPerfStats`]
|
/// Update the current [`ClientPerfMonitor`] with the given [`ClientPerfMonitor`]
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
pub fn update_introspection_stats(&mut self, introspection_stats: ClientPerfStats) {
|
pub fn update_introspection_monitor(&mut self, introspection_monitor: ClientPerfMonitor) {
|
||||||
self.introspection_stats = introspection_stats;
|
self.introspection_monitor = introspection_monitor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The stats trait keeps track of all the client's stats, and offers methods to dispaly them.
|
/// The monitor trait keeps track of all the client's monitor, and offers methods to dispaly them.
|
||||||
pub trait Stats {
|
pub trait Monitor {
|
||||||
/// the client stats (mut)
|
/// the client monitor (mut)
|
||||||
fn client_stats_mut(&mut self) -> &mut Vec<ClientStats>;
|
fn client_stats_mut(&mut self) -> &mut Vec<ClientStats>;
|
||||||
|
|
||||||
/// the client stats
|
/// the client monitor
|
||||||
fn client_stats(&self) -> &[ClientStats];
|
fn client_stats(&self) -> &[ClientStats];
|
||||||
|
|
||||||
/// creation time
|
/// creation time
|
||||||
fn start_time(&mut self) -> time::Duration;
|
fn start_time(&mut self) -> time::Duration;
|
||||||
|
|
||||||
/// show the stats to the user
|
/// show the monitor to the user
|
||||||
fn display(&mut self, event_msg: String, sender_id: u32);
|
fn display(&mut self, event_msg: String, sender_id: u32);
|
||||||
|
|
||||||
/// Amount of elements in the corpus (combined for all children)
|
/// Amount of elements in the corpus (combined for all children)
|
||||||
@ -181,7 +181,7 @@ pub trait Stats {
|
|||||||
.fold(0_u64, |acc, x| acc + x.execs_per_sec(cur_time))
|
.fold(0_u64, |acc, x| acc + x.execs_per_sec(cur_time))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The client stats for a specific id, creating new if it doesn't exist
|
/// The client monitor for a specific id, creating new if it doesn't exist
|
||||||
fn client_stats_mut_for(&mut self, client_id: u32) -> &mut ClientStats {
|
fn client_stats_mut_for(&mut self, client_id: u32) -> &mut ClientStats {
|
||||||
let client_stat_count = self.client_stats().len();
|
let client_stat_count = self.client_stats().len();
|
||||||
for _ in client_stat_count..(client_id + 1) as usize {
|
for _ in client_stat_count..(client_id + 1) as usize {
|
||||||
@ -194,20 +194,20 @@ pub trait Stats {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Stats that print exactly nothing.
|
/// Monitor that print exactly nothing.
|
||||||
/// Not good for debuging, very good for speed.
|
/// Not good for debuging, very good for speed.
|
||||||
pub struct NopStats {
|
pub struct NopMonitor {
|
||||||
start_time: Duration,
|
start_time: Duration,
|
||||||
client_stats: Vec<ClientStats>,
|
client_stats: Vec<ClientStats>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Stats for NopStats {
|
impl Monitor for NopMonitor {
|
||||||
/// the client stats, mutable
|
/// the client monitor, mutable
|
||||||
fn client_stats_mut(&mut self) -> &mut Vec<ClientStats> {
|
fn client_stats_mut(&mut self) -> &mut Vec<ClientStats> {
|
||||||
&mut self.client_stats
|
&mut self.client_stats
|
||||||
}
|
}
|
||||||
|
|
||||||
/// the client stats
|
/// the client monitor
|
||||||
fn client_stats(&self) -> &[ClientStats] {
|
fn client_stats(&self) -> &[ClientStats] {
|
||||||
&self.client_stats
|
&self.client_stats
|
||||||
}
|
}
|
||||||
@ -220,8 +220,8 @@ impl Stats for NopStats {
|
|||||||
fn display(&mut self, _event_msg: String, _sender_id: u32) {}
|
fn display(&mut self, _event_msg: String, _sender_id: u32) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl NopStats {
|
impl NopMonitor {
|
||||||
/// Create new [`NopStats`]
|
/// Create new [`NopMonitor`]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -231,15 +231,15 @@ impl NopStats {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for NopStats {
|
impl Default for NopMonitor {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::new()
|
Self::new()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Tracking stats during fuzzing.
|
/// Tracking monitor during fuzzing.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct SimpleStats<F>
|
pub struct SimpleMonitor<F>
|
||||||
where
|
where
|
||||||
F: FnMut(String),
|
F: FnMut(String),
|
||||||
{
|
{
|
||||||
@ -248,16 +248,16 @@ where
|
|||||||
client_stats: Vec<ClientStats>,
|
client_stats: Vec<ClientStats>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<F> Stats for SimpleStats<F>
|
impl<F> Monitor for SimpleMonitor<F>
|
||||||
where
|
where
|
||||||
F: FnMut(String),
|
F: FnMut(String),
|
||||||
{
|
{
|
||||||
/// the client stats, mutable
|
/// the client monitor, mutable
|
||||||
fn client_stats_mut(&mut self) -> &mut Vec<ClientStats> {
|
fn client_stats_mut(&mut self) -> &mut Vec<ClientStats> {
|
||||||
&mut self.client_stats
|
&mut self.client_stats
|
||||||
}
|
}
|
||||||
|
|
||||||
/// the client stats
|
/// the client monitor
|
||||||
fn client_stats(&self) -> &[ClientStats] {
|
fn client_stats(&self) -> &[ClientStats] {
|
||||||
&self.client_stats
|
&self.client_stats
|
||||||
}
|
}
|
||||||
@ -269,7 +269,8 @@ where
|
|||||||
|
|
||||||
fn display(&mut self, event_msg: String, sender_id: u32) {
|
fn display(&mut self, event_msg: String, sender_id: u32) {
|
||||||
let fmt = format!(
|
let fmt = format!(
|
||||||
"[{} #{}] clients: {}, corpus: {}, objectives: {}, executions: {}, exec/sec: {}",
|
"{}: [{} #{}] clients: {}, corpus: {}, objectives: {}, executions: {}, exec/sec: {}",
|
||||||
|
(current_time() - self.start_time).as_millis(),
|
||||||
event_msg,
|
event_msg,
|
||||||
sender_id,
|
sender_id,
|
||||||
self.client_stats().len(),
|
self.client_stats().len(),
|
||||||
@ -280,13 +281,13 @@ where
|
|||||||
);
|
);
|
||||||
(self.print_fn)(fmt);
|
(self.print_fn)(fmt);
|
||||||
|
|
||||||
// Only print perf stats if the feature is enabled
|
// Only print perf monitor if the feature is enabled
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
{
|
{
|
||||||
// Print the client performance stats.
|
// Print the client performance monitor.
|
||||||
let fmt = format!(
|
let fmt = format!(
|
||||||
"Client {:03}:\n{}",
|
"Client {:03}:\n{}",
|
||||||
sender_id, self.client_stats[sender_id as usize].introspection_stats
|
sender_id, self.client_stats[sender_id as usize].introspection_monitor
|
||||||
);
|
);
|
||||||
(self.print_fn)(fmt);
|
(self.print_fn)(fmt);
|
||||||
|
|
||||||
@ -296,11 +297,11 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<F> SimpleStats<F>
|
impl<F> SimpleMonitor<F>
|
||||||
where
|
where
|
||||||
F: FnMut(String),
|
F: FnMut(String),
|
||||||
{
|
{
|
||||||
/// Creates the stats, using the `current_time` as `start_time`.
|
/// Creates the monitor, using the `current_time` as `start_time`.
|
||||||
pub fn new(print_fn: F) -> Self {
|
pub fn new(print_fn: F) -> Self {
|
||||||
Self {
|
Self {
|
||||||
print_fn,
|
print_fn,
|
||||||
@ -309,7 +310,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates the stats with a given `start_time`.
|
/// Creates the monitor with a given `start_time`.
|
||||||
pub fn with_time(print_fn: F, start_time: time::Duration) -> Self {
|
pub fn with_time(print_fn: F, start_time: time::Duration) -> Self {
|
||||||
Self {
|
Self {
|
||||||
print_fn,
|
print_fn,
|
||||||
@ -324,7 +325,7 @@ macro_rules! start_timer {
|
|||||||
($state:expr) => {{
|
($state:expr) => {{
|
||||||
// Start the timer
|
// Start the timer
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
$state.introspection_stats_mut().start_timer();
|
$state.introspection_monitor_mut().start_timer();
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -333,7 +334,9 @@ macro_rules! mark_feature_time {
|
|||||||
($state:expr, $feature:expr) => {{
|
($state:expr, $feature:expr) => {{
|
||||||
// Mark the elapsed time for the given feature
|
// Mark the elapsed time for the given feature
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
$state.introspection_stats_mut().mark_feature_time($feature);
|
$state
|
||||||
|
.introspection_monitor_mut()
|
||||||
|
.mark_feature_time($feature);
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,13 +345,13 @@ macro_rules! mark_feedback_time {
|
|||||||
($state:expr) => {{
|
($state:expr) => {{
|
||||||
// Mark the elapsed time for the given feature
|
// Mark the elapsed time for the given feature
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
$state.introspection_stats_mut().mark_feedback_time();
|
$state.introspection_monitor_mut().mark_feedback_time();
|
||||||
}};
|
}};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Client performance statistics
|
/// Client performance statistics
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||||
pub struct ClientPerfStats {
|
pub struct ClientPerfMonitor {
|
||||||
/// Starting counter (in clock cycles from `read_time_counter`)
|
/// Starting counter (in clock cycles from `read_time_counter`)
|
||||||
start_time: u64,
|
start_time: u64,
|
||||||
|
|
||||||
@ -465,8 +468,8 @@ impl From<usize> for PerfFeature {
|
|||||||
pub const NUM_PERF_FEATURES: usize = PerfFeature::Count as usize;
|
pub const NUM_PERF_FEATURES: usize = PerfFeature::Count as usize;
|
||||||
|
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
impl ClientPerfStats {
|
impl ClientPerfMonitor {
|
||||||
/// Create a blank [`ClientPerfStats`] with the `start_time` and `current_time` with
|
/// Create a blank [`ClientPerfMonitor`] with the `start_time` and `current_time` with
|
||||||
/// the current clock counter
|
/// the current clock counter
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
@ -497,13 +500,13 @@ impl ClientPerfStats {
|
|||||||
self.timer_start = Some(crate::bolts::cpu::read_time_counter());
|
self.timer_start = Some(crate::bolts::cpu::read_time_counter());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Update the current [`ClientPerfStats`] with the given [`ClientPerfStats`]
|
/// Update the current [`ClientPerfMonitor`] with the given [`ClientPerfMonitor`]
|
||||||
pub fn update(&mut self, stats: &ClientPerfStats) {
|
pub fn update(&mut self, monitor: &ClientPerfMonitor) {
|
||||||
self.set_current_time(stats.current_time);
|
self.set_current_time(monitor.current_time);
|
||||||
self.update_scheduler(stats.scheduler);
|
self.update_scheduler(monitor.scheduler);
|
||||||
self.update_manager(stats.manager);
|
self.update_manager(monitor.manager);
|
||||||
self.update_stages(&stats.stages);
|
self.update_stages(&monitor.stages);
|
||||||
self.update_feedbacks(&stats.feedbacks);
|
self.update_feedbacks(&monitor.feedbacks);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets the elapsed time since the internal timer started. Resets the timer when
|
/// Gets the elapsed time since the internal timer started. Resets the timer when
|
||||||
@ -562,7 +565,7 @@ impl ClientPerfStats {
|
|||||||
self.update_feature(feature, elapsed);
|
self.update_feature(feature, elapsed);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add the given `time` to the `scheduler` stats
|
/// Add the given `time` to the `scheduler` monitor
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn update_scheduler(&mut self, time: u64) {
|
pub fn update_scheduler(&mut self, time: u64) {
|
||||||
self.scheduler = self
|
self.scheduler = self
|
||||||
@ -571,7 +574,7 @@ impl ClientPerfStats {
|
|||||||
.expect("update_scheduler overflow");
|
.expect("update_scheduler overflow");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add the given `time` to the `manager` stats
|
/// Add the given `time` to the `manager` monitor
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn update_manager(&mut self, time: u64) {
|
pub fn update_manager(&mut self, time: u64) {
|
||||||
self.manager = self
|
self.manager = self
|
||||||
@ -689,10 +692,10 @@ impl ClientPerfStats {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
impl core::fmt::Display for ClientPerfStats {
|
impl core::fmt::Display for ClientPerfMonitor {
|
||||||
#[allow(clippy::cast_precision_loss)]
|
#[allow(clippy::cast_precision_loss)]
|
||||||
fn fmt(&self, f: &mut core::fmt::Formatter) -> Result<(), core::fmt::Error> {
|
fn fmt(&self, f: &mut core::fmt::Formatter) -> Result<(), core::fmt::Error> {
|
||||||
// Calculate the elapsed time from the stats
|
// Calculate the elapsed time from the monitor
|
||||||
let elapsed: f64 = self.elapsed_cycles() as f64;
|
let elapsed: f64 = self.elapsed_cycles() as f64;
|
||||||
|
|
||||||
// Calculate the percentages for each benchmark
|
// Calculate the percentages for each benchmark
|
||||||
@ -762,7 +765,7 @@ impl core::fmt::Display for ClientPerfStats {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
impl Default for ClientPerfStats {
|
impl Default for ClientPerfMonitor {
|
||||||
#[must_use]
|
#[must_use]
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self::new()
|
Self::new()
|
@ -1,4 +1,4 @@
|
|||||||
//! Stats to disply both cumulative and per-client stats
|
//! Monitor to disply both cumulative and per-client monitor
|
||||||
|
|
||||||
use alloc::{string::String, vec::Vec};
|
use alloc::{string::String, vec::Vec};
|
||||||
use core::{time, time::Duration};
|
use core::{time, time::Duration};
|
||||||
@ -8,12 +8,12 @@ use alloc::string::ToString;
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
bolts::current_time,
|
bolts::current_time,
|
||||||
stats::{ClientStats, Stats},
|
monitors::{ClientStats, Monitor},
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Tracking stats during fuzzing and display both per-client and cumulative info.
|
/// Tracking monitor during fuzzing and display both per-client and cumulative info.
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct MultiStats<F>
|
pub struct MultiMonitor<F>
|
||||||
where
|
where
|
||||||
F: FnMut(String),
|
F: FnMut(String),
|
||||||
{
|
{
|
||||||
@ -22,16 +22,16 @@ where
|
|||||||
client_stats: Vec<ClientStats>,
|
client_stats: Vec<ClientStats>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<F> Stats for MultiStats<F>
|
impl<F> Monitor for MultiMonitor<F>
|
||||||
where
|
where
|
||||||
F: FnMut(String),
|
F: FnMut(String),
|
||||||
{
|
{
|
||||||
/// the client stats, mutable
|
/// the client monitor, mutable
|
||||||
fn client_stats_mut(&mut self) -> &mut Vec<ClientStats> {
|
fn client_stats_mut(&mut self) -> &mut Vec<ClientStats> {
|
||||||
&mut self.client_stats
|
&mut self.client_stats
|
||||||
}
|
}
|
||||||
|
|
||||||
/// the client stats
|
/// the client monitor
|
||||||
fn client_stats(&self) -> &[ClientStats] {
|
fn client_stats(&self) -> &[ClientStats] {
|
||||||
&self.client_stats
|
&self.client_stats
|
||||||
}
|
}
|
||||||
@ -69,17 +69,17 @@ where
|
|||||||
" {} (CLIENT) corpus: {}, objectives: {}, executions: {}, exec/sec: {}",
|
" {} (CLIENT) corpus: {}, objectives: {}, executions: {}, exec/sec: {}",
|
||||||
pad, client.corpus_size, client.objective_size, client.executions, exec_sec
|
pad, client.corpus_size, client.objective_size, client.executions, exec_sec
|
||||||
);
|
);
|
||||||
for (key, val) in &client.user_stats {
|
for (key, val) in &client.user_monitor {
|
||||||
fmt += &format!(", {}: {}", key, val);
|
fmt += &format!(", {}: {}", key, val);
|
||||||
}
|
}
|
||||||
(self.print_fn)(fmt);
|
(self.print_fn)(fmt);
|
||||||
|
|
||||||
// Only print perf stats if the feature is enabled
|
// Only print perf monitor if the feature is enabled
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
{
|
{
|
||||||
// Print the client performance stats. Skip the Client 0 which is the broker
|
// Print the client performance monitor. Skip the Client 0 which is the broker
|
||||||
for (i, client) in self.client_stats.iter().skip(1).enumerate() {
|
for (i, client) in self.client_stats.iter().skip(1).enumerate() {
|
||||||
let fmt = format!("Client {:03}:\n{}", i + 1, client.introspection_stats);
|
let fmt = format!("Client {:03}:\n{}", i + 1, client.introspection_monitor);
|
||||||
(self.print_fn)(fmt);
|
(self.print_fn)(fmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,11 +89,11 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<F> MultiStats<F>
|
impl<F> MultiMonitor<F>
|
||||||
where
|
where
|
||||||
F: FnMut(String),
|
F: FnMut(String),
|
||||||
{
|
{
|
||||||
/// Creates the stats, using the `current_time` as `start_time`.
|
/// Creates the monitor, using the `current_time` as `start_time`.
|
||||||
pub fn new(print_fn: F) -> Self {
|
pub fn new(print_fn: F) -> Self {
|
||||||
Self {
|
Self {
|
||||||
print_fn,
|
print_fn,
|
||||||
@ -102,7 +102,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates the stats with a given `start_time`.
|
/// Creates the monitor with a given `start_time`.
|
||||||
pub fn with_time(print_fn: F, start_time: time::Duration) -> Self {
|
pub fn with_time(print_fn: F, start_time: time::Duration) -> Self {
|
||||||
Self {
|
Self {
|
||||||
print_fn,
|
print_fn,
|
@ -9,7 +9,7 @@ use crate::{
|
|||||||
executors::{Executor, HasObservers},
|
executors::{Executor, HasObservers},
|
||||||
inputs::Input,
|
inputs::Input,
|
||||||
observers::{concolic::ConcolicObserver, ObserversTuple},
|
observers::{concolic::ConcolicObserver, ObserversTuple},
|
||||||
state::{HasClientPerfStats, HasCorpus, HasExecutions, HasMetadata},
|
state::{HasClientPerfMonitor, HasCorpus, HasExecutions, HasMetadata},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ where
|
|||||||
C: Corpus<I>,
|
C: Corpus<I>,
|
||||||
TE: Executor<EM, I, S, Z> + HasObservers<I, OT, S>,
|
TE: Executor<EM, I, S, Z> + HasObservers<I, OT, S>,
|
||||||
OT: ObserversTuple<I, S>,
|
OT: ObserversTuple<I, S>,
|
||||||
S: HasClientPerfStats + HasExecutions + HasCorpus<C, I>,
|
S: HasClientPerfMonitor + HasExecutions + HasCorpus<C, I>,
|
||||||
{
|
{
|
||||||
inner: TracingStage<C, EM, I, OT, S, TE, Z>,
|
inner: TracingStage<C, EM, I, OT, S, TE, Z>,
|
||||||
observer_name: String,
|
observer_name: String,
|
||||||
@ -35,7 +35,7 @@ where
|
|||||||
C: Corpus<I>,
|
C: Corpus<I>,
|
||||||
TE: Executor<EM, I, S, Z> + HasObservers<I, OT, S>,
|
TE: Executor<EM, I, S, Z> + HasObservers<I, OT, S>,
|
||||||
OT: ObserversTuple<I, S>,
|
OT: ObserversTuple<I, S>,
|
||||||
S: HasClientPerfStats + HasExecutions + HasCorpus<C, I>,
|
S: HasClientPerfMonitor + HasExecutions + HasCorpus<C, I>,
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
fn perform(
|
fn perform(
|
||||||
@ -73,7 +73,7 @@ where
|
|||||||
C: Corpus<I>,
|
C: Corpus<I>,
|
||||||
TE: Executor<EM, I, S, Z> + HasObservers<I, OT, S>,
|
TE: Executor<EM, I, S, Z> + HasObservers<I, OT, S>,
|
||||||
OT: ObserversTuple<I, S>,
|
OT: ObserversTuple<I, S>,
|
||||||
S: HasClientPerfStats + HasExecutions + HasCorpus<C, I>,
|
S: HasClientPerfMonitor + HasExecutions + HasCorpus<C, I>,
|
||||||
{
|
{
|
||||||
/// Creates a new default tracing stage using the given [`Executor`], observing traces from a [`ConcolicObserver`] with the given name.
|
/// Creates a new default tracing stage using the given [`Executor`], observing traces from a [`ConcolicObserver`] with the given name.
|
||||||
pub fn new(inner: TracingStage<C, EM, I, OT, S, TE, Z>, observer_name: String) -> Self {
|
pub fn new(inner: TracingStage<C, EM, I, OT, S, TE, Z>, observer_name: String) -> Self {
|
||||||
@ -93,7 +93,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(all(feature = "concolic_mutation", feature = "introspection"))]
|
#[cfg(all(feature = "concolic_mutation", feature = "introspection"))]
|
||||||
use crate::stats::PerfFeature;
|
use crate::monitors::PerfFeature;
|
||||||
|
|
||||||
#[cfg(feature = "concolic_mutation")]
|
#[cfg(feature = "concolic_mutation")]
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
@ -348,7 +348,7 @@ pub struct SimpleConcolicMutationalStage<C, EM, I, S, Z>
|
|||||||
where
|
where
|
||||||
I: Input,
|
I: Input,
|
||||||
C: Corpus<I>,
|
C: Corpus<I>,
|
||||||
S: HasClientPerfStats + HasExecutions + HasCorpus<C, I>,
|
S: HasClientPerfMonitor + HasExecutions + HasCorpus<C, I>,
|
||||||
{
|
{
|
||||||
_phantom: PhantomData<(C, EM, I, S, Z)>,
|
_phantom: PhantomData<(C, EM, I, S, Z)>,
|
||||||
}
|
}
|
||||||
@ -358,7 +358,7 @@ impl<E, C, EM, I, S, Z> Stage<E, EM, S, Z> for SimpleConcolicMutationalStage<C,
|
|||||||
where
|
where
|
||||||
I: Input + HasBytesVec,
|
I: Input + HasBytesVec,
|
||||||
C: Corpus<I>,
|
C: Corpus<I>,
|
||||||
S: HasClientPerfStats + HasExecutions + HasCorpus<C, I>,
|
S: HasClientPerfMonitor + HasExecutions + HasCorpus<C, I>,
|
||||||
Z: Evaluator<E, EM, I, S>,
|
Z: Evaluator<E, EM, I, S>,
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -402,7 +402,7 @@ impl<C, EM, I, S, Z> Default for SimpleConcolicMutationalStage<C, EM, I, S, Z>
|
|||||||
where
|
where
|
||||||
I: Input,
|
I: Input,
|
||||||
C: Corpus<I>,
|
C: Corpus<I>,
|
||||||
S: HasClientPerfStats + HasExecutions + HasCorpus<C, I>,
|
S: HasClientPerfMonitor + HasExecutions + HasCorpus<C, I>,
|
||||||
{
|
{
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
@ -12,12 +12,12 @@ use crate::{
|
|||||||
mutators::Mutator,
|
mutators::Mutator,
|
||||||
stages::Stage,
|
stages::Stage,
|
||||||
start_timer,
|
start_timer,
|
||||||
state::{HasClientPerfStats, HasCorpus, HasRand},
|
state::{HasClientPerfMonitor, HasCorpus, HasRand},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
use crate::stats::PerfFeature;
|
use crate::monitors::PerfFeature;
|
||||||
|
|
||||||
// TODO multi mutators stage
|
// TODO multi mutators stage
|
||||||
|
|
||||||
@ -29,7 +29,7 @@ where
|
|||||||
C: Corpus<I>,
|
C: Corpus<I>,
|
||||||
M: Mutator<I, S>,
|
M: Mutator<I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
S: HasClientPerfStats + HasCorpus<C, I>,
|
S: HasClientPerfMonitor + HasCorpus<C, I>,
|
||||||
Z: Evaluator<E, EM, I, S>,
|
Z: Evaluator<E, EM, I, S>,
|
||||||
{
|
{
|
||||||
/// The mutator registered for this stage
|
/// The mutator registered for this stage
|
||||||
@ -90,7 +90,7 @@ where
|
|||||||
M: Mutator<I, S>,
|
M: Mutator<I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
R: Rand,
|
R: Rand,
|
||||||
S: HasClientPerfStats + HasCorpus<C, I> + HasRand<R>,
|
S: HasClientPerfMonitor + HasCorpus<C, I> + HasRand<R>,
|
||||||
Z: Evaluator<E, EM, I, S>,
|
Z: Evaluator<E, EM, I, S>,
|
||||||
{
|
{
|
||||||
mutator: M,
|
mutator: M,
|
||||||
@ -105,7 +105,7 @@ where
|
|||||||
M: Mutator<I, S>,
|
M: Mutator<I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
R: Rand,
|
R: Rand,
|
||||||
S: HasClientPerfStats + HasCorpus<C, I> + HasRand<R>,
|
S: HasClientPerfMonitor + HasCorpus<C, I> + HasRand<R>,
|
||||||
Z: Evaluator<E, EM, I, S>,
|
Z: Evaluator<E, EM, I, S>,
|
||||||
{
|
{
|
||||||
/// The mutator, added to this stage
|
/// The mutator, added to this stage
|
||||||
@ -132,7 +132,7 @@ where
|
|||||||
M: Mutator<I, S>,
|
M: Mutator<I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
R: Rand,
|
R: Rand,
|
||||||
S: HasClientPerfStats + HasCorpus<C, I> + HasRand<R>,
|
S: HasClientPerfMonitor + HasCorpus<C, I> + HasRand<R>,
|
||||||
Z: Evaluator<E, EM, I, S>,
|
Z: Evaluator<E, EM, I, S>,
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -148,7 +148,7 @@ where
|
|||||||
let ret = self.perform_mutational(fuzzer, executor, state, manager, corpus_idx);
|
let ret = self.perform_mutational(fuzzer, executor, state, manager, corpus_idx);
|
||||||
|
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
state.introspection_stats_mut().finish_stage();
|
state.introspection_monitor_mut().finish_stage();
|
||||||
|
|
||||||
ret
|
ret
|
||||||
}
|
}
|
||||||
@ -160,7 +160,7 @@ where
|
|||||||
M: Mutator<I, S>,
|
M: Mutator<I, S>,
|
||||||
I: Input,
|
I: Input,
|
||||||
R: Rand,
|
R: Rand,
|
||||||
S: HasClientPerfStats + HasCorpus<C, I> + HasRand<R>,
|
S: HasClientPerfMonitor + HasCorpus<C, I> + HasRand<R>,
|
||||||
Z: Evaluator<E, EM, I, S>,
|
Z: Evaluator<E, EM, I, S>,
|
||||||
{
|
{
|
||||||
/// Creates a new default mutational stage
|
/// Creates a new default mutational stage
|
||||||
|
@ -12,7 +12,7 @@ use crate::{
|
|||||||
mutators::Mutator,
|
mutators::Mutator,
|
||||||
observers::{MapObserver, ObserversTuple},
|
observers::{MapObserver, ObserversTuple},
|
||||||
stages::{MutationalStage, PowerScheduleMetadata, Stage},
|
stages::{MutationalStage, PowerScheduleMetadata, Stage},
|
||||||
state::{HasClientPerfStats, HasCorpus, HasMetadata},
|
state::{HasClientPerfMonitor, HasCorpus, HasMetadata},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ where
|
|||||||
M: Mutator<I, S>,
|
M: Mutator<I, S>,
|
||||||
O: MapObserver<T>,
|
O: MapObserver<T>,
|
||||||
OT: ObserversTuple<I, S>,
|
OT: ObserversTuple<I, S>,
|
||||||
S: HasClientPerfStats + HasCorpus<C, I> + HasMetadata,
|
S: HasClientPerfMonitor + HasCorpus<C, I> + HasMetadata,
|
||||||
Z: Evaluator<E, EM, I, S>,
|
Z: Evaluator<E, EM, I, S>,
|
||||||
{
|
{
|
||||||
map_observer_name: String,
|
map_observer_name: String,
|
||||||
@ -62,7 +62,7 @@ where
|
|||||||
M: Mutator<I, S>,
|
M: Mutator<I, S>,
|
||||||
O: MapObserver<T>,
|
O: MapObserver<T>,
|
||||||
OT: ObserversTuple<I, S>,
|
OT: ObserversTuple<I, S>,
|
||||||
S: HasClientPerfStats + HasCorpus<C, I> + HasMetadata,
|
S: HasClientPerfMonitor + HasCorpus<C, I> + HasMetadata,
|
||||||
Z: Evaluator<E, EM, I, S>,
|
Z: Evaluator<E, EM, I, S>,
|
||||||
{
|
{
|
||||||
/// The mutator, added to this stage
|
/// The mutator, added to this stage
|
||||||
@ -163,7 +163,7 @@ where
|
|||||||
M: Mutator<I, S>,
|
M: Mutator<I, S>,
|
||||||
O: MapObserver<T>,
|
O: MapObserver<T>,
|
||||||
OT: ObserversTuple<I, S>,
|
OT: ObserversTuple<I, S>,
|
||||||
S: HasClientPerfStats + HasCorpus<C, I> + HasMetadata,
|
S: HasClientPerfMonitor + HasCorpus<C, I> + HasMetadata,
|
||||||
Z: Evaluator<E, EM, I, S>,
|
Z: Evaluator<E, EM, I, S>,
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -190,7 +190,7 @@ where
|
|||||||
M: Mutator<I, S>,
|
M: Mutator<I, S>,
|
||||||
O: MapObserver<T>,
|
O: MapObserver<T>,
|
||||||
OT: ObserversTuple<I, S>,
|
OT: ObserversTuple<I, S>,
|
||||||
S: HasClientPerfStats + HasCorpus<C, I> + HasMetadata,
|
S: HasClientPerfMonitor + HasCorpus<C, I> + HasMetadata,
|
||||||
Z: Evaluator<E, EM, I, S>,
|
Z: Evaluator<E, EM, I, S>,
|
||||||
{
|
{
|
||||||
pub fn new(mutator: M, strat: PowerSchedule, map_observer_name: &O) -> Self {
|
pub fn new(mutator: M, strat: PowerSchedule, map_observer_name: &O) -> Self {
|
||||||
|
@ -19,14 +19,14 @@ use crate::{
|
|||||||
mutators::Mutator,
|
mutators::Mutator,
|
||||||
observers::ObserversTuple,
|
observers::ObserversTuple,
|
||||||
start_timer,
|
start_timer,
|
||||||
state::{HasClientPerfStats, HasCorpus, HasRand},
|
state::{HasClientPerfMonitor, HasCorpus, HasRand},
|
||||||
Error, EvaluatorObservers, ExecutionProcessor, Fuzzer, HasCorpusScheduler,
|
Error, EvaluatorObservers, ExecutionProcessor, Fuzzer, HasCorpusScheduler,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
use crate::stats::PerfFeature;
|
use crate::monitors::PerfFeature;
|
||||||
|
|
||||||
/// Send a stats update all 15 (or more) seconds
|
/// Send a monitor update all 15 (or more) seconds
|
||||||
const STATS_TIMEOUT_DEFAULT: Duration = Duration::from_secs(15);
|
const STATS_TIMEOUT_DEFAULT: Duration = Duration::from_secs(15);
|
||||||
|
|
||||||
pub static DEFAULT_MUTATIONAL_MAX_ITERATIONS: u64 = 128;
|
pub static DEFAULT_MUTATIONAL_MAX_ITERATIONS: u64 = 128;
|
||||||
@ -50,7 +50,7 @@ where
|
|||||||
M: Mutator<I, S>,
|
M: Mutator<I, S>,
|
||||||
OT: ObserversTuple<I, S>,
|
OT: ObserversTuple<I, S>,
|
||||||
R: Rand,
|
R: Rand,
|
||||||
S: HasClientPerfStats + HasCorpus<C, I> + HasRand<R>,
|
S: HasClientPerfMonitor + HasCorpus<C, I> + HasRand<R>,
|
||||||
Z: ExecutionProcessor<I, OT, S>
|
Z: ExecutionProcessor<I, OT, S>
|
||||||
+ EvaluatorObservers<I, OT, S>
|
+ EvaluatorObservers<I, OT, S>
|
||||||
+ Fuzzer<(), EM, I, S, ()>
|
+ Fuzzer<(), EM, I, S, ()>
|
||||||
@ -73,7 +73,7 @@ where
|
|||||||
mutator: M,
|
mutator: M,
|
||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
phantom: PhantomData<(C, CS, (), EM, I, R, OT, S, Z)>,
|
phantom: PhantomData<(C, CS, (), EM, I, R, OT, S, Z)>,
|
||||||
last_stats_time: Duration,
|
last_monitor_time: Duration,
|
||||||
observers: Rc<RefCell<OT>>,
|
observers: Rc<RefCell<OT>>,
|
||||||
exit_kind: Rc<Cell<Option<ExitKind>>>,
|
exit_kind: Rc<Cell<Option<ExitKind>>>,
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ where
|
|||||||
M: Mutator<I, S>,
|
M: Mutator<I, S>,
|
||||||
OT: ObserversTuple<I, S>,
|
OT: ObserversTuple<I, S>,
|
||||||
R: Rand,
|
R: Rand,
|
||||||
S: HasClientPerfStats + HasCorpus<C, I> + HasRand<R>,
|
S: HasClientPerfMonitor + HasCorpus<C, I> + HasRand<R>,
|
||||||
Z: ExecutionProcessor<I, OT, S>
|
Z: ExecutionProcessor<I, OT, S>
|
||||||
+ EvaluatorObservers<I, OT, S>
|
+ EvaluatorObservers<I, OT, S>
|
||||||
+ Fuzzer<(), EM, I, S, ()>
|
+ Fuzzer<(), EM, I, S, ()>
|
||||||
@ -188,7 +188,7 @@ where
|
|||||||
M: Mutator<I, S>,
|
M: Mutator<I, S>,
|
||||||
OT: ObserversTuple<I, S>,
|
OT: ObserversTuple<I, S>,
|
||||||
R: Rand,
|
R: Rand,
|
||||||
S: HasClientPerfStats + HasCorpus<C, I> + HasRand<R>,
|
S: HasClientPerfMonitor + HasCorpus<C, I> + HasRand<R>,
|
||||||
Z: ExecutionProcessor<I, OT, S>
|
Z: ExecutionProcessor<I, OT, S>
|
||||||
+ EvaluatorObservers<I, OT, S>
|
+ EvaluatorObservers<I, OT, S>
|
||||||
+ Fuzzer<(), EM, I, S, ()>
|
+ Fuzzer<(), EM, I, S, ()>
|
||||||
@ -219,14 +219,14 @@ where
|
|||||||
//let fuzzer: &mut Z = &mut (*self.fuzzer).borrow_mut();
|
//let fuzzer: &mut Z = &mut (*self.fuzzer).borrow_mut();
|
||||||
let event_mgr: &mut EM = &mut (*self.event_mgr).borrow_mut();
|
let event_mgr: &mut EM = &mut (*self.event_mgr).borrow_mut();
|
||||||
|
|
||||||
self.last_stats_time = Z::maybe_report_stats(
|
self.last_monitor_time = Z::maybe_report_monitor(
|
||||||
state,
|
state,
|
||||||
event_mgr,
|
event_mgr,
|
||||||
self.last_stats_time,
|
self.last_monitor_time,
|
||||||
STATS_TIMEOUT_DEFAULT,
|
STATS_TIMEOUT_DEFAULT,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
//self.fuzzer.maybe_report_stats();
|
//self.fuzzer.maybe_report_monitor();
|
||||||
} else {
|
} else {
|
||||||
self.exit_kind.replace(None);
|
self.exit_kind.replace(None);
|
||||||
}
|
}
|
||||||
@ -243,7 +243,7 @@ where
|
|||||||
M: Mutator<I, S>,
|
M: Mutator<I, S>,
|
||||||
OT: ObserversTuple<I, S>,
|
OT: ObserversTuple<I, S>,
|
||||||
R: Rand,
|
R: Rand,
|
||||||
S: HasClientPerfStats + HasCorpus<C, I> + HasRand<R>,
|
S: HasClientPerfMonitor + HasCorpus<C, I> + HasRand<R>,
|
||||||
Z: ExecutionProcessor<I, OT, S>
|
Z: ExecutionProcessor<I, OT, S>
|
||||||
+ EvaluatorObservers<I, OT, S>
|
+ EvaluatorObservers<I, OT, S>
|
||||||
+ Fuzzer<(), EM, I, S, ()>
|
+ Fuzzer<(), EM, I, S, ()>
|
||||||
@ -274,7 +274,7 @@ where
|
|||||||
event_mgr,
|
event_mgr,
|
||||||
observers,
|
observers,
|
||||||
exit_kind,
|
exit_kind,
|
||||||
last_stats_time: current_time(),
|
last_monitor_time: current_time(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,12 +10,12 @@ use crate::{
|
|||||||
observers::ObserversTuple,
|
observers::ObserversTuple,
|
||||||
stages::Stage,
|
stages::Stage,
|
||||||
start_timer,
|
start_timer,
|
||||||
state::{HasClientPerfStats, HasCorpus, HasExecutions},
|
state::{HasClientPerfMonitor, HasCorpus, HasExecutions},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
use crate::stats::PerfFeature;
|
use crate::monitors::PerfFeature;
|
||||||
|
|
||||||
/// A stage that runs a tracer executor
|
/// A stage that runs a tracer executor
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
@ -25,7 +25,7 @@ where
|
|||||||
C: Corpus<I>,
|
C: Corpus<I>,
|
||||||
TE: Executor<EM, I, S, Z> + HasObservers<I, OT, S>,
|
TE: Executor<EM, I, S, Z> + HasObservers<I, OT, S>,
|
||||||
OT: ObserversTuple<I, S>,
|
OT: ObserversTuple<I, S>,
|
||||||
S: HasClientPerfStats + HasExecutions + HasCorpus<C, I>,
|
S: HasClientPerfMonitor + HasExecutions + HasCorpus<C, I>,
|
||||||
{
|
{
|
||||||
tracer_executor: TE,
|
tracer_executor: TE,
|
||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
@ -38,7 +38,7 @@ where
|
|||||||
C: Corpus<I>,
|
C: Corpus<I>,
|
||||||
TE: Executor<EM, I, S, Z> + HasObservers<I, OT, S>,
|
TE: Executor<EM, I, S, Z> + HasObservers<I, OT, S>,
|
||||||
OT: ObserversTuple<I, S>,
|
OT: ObserversTuple<I, S>,
|
||||||
S: HasClientPerfStats + HasExecutions + HasCorpus<C, I>,
|
S: HasClientPerfMonitor + HasExecutions + HasCorpus<C, I>,
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
fn perform(
|
fn perform(
|
||||||
@ -88,7 +88,7 @@ where
|
|||||||
C: Corpus<I>,
|
C: Corpus<I>,
|
||||||
TE: Executor<EM, I, S, Z> + HasObservers<I, OT, S>,
|
TE: Executor<EM, I, S, Z> + HasObservers<I, OT, S>,
|
||||||
OT: ObserversTuple<I, S>,
|
OT: ObserversTuple<I, S>,
|
||||||
S: HasClientPerfStats + HasExecutions + HasCorpus<C, I>,
|
S: HasClientPerfMonitor + HasExecutions + HasCorpus<C, I>,
|
||||||
{
|
{
|
||||||
/// Creates a new default stage
|
/// Creates a new default stage
|
||||||
pub fn new(tracer_executor: TE) -> Self {
|
pub fn new(tracer_executor: TE) -> Self {
|
||||||
@ -118,7 +118,7 @@ where
|
|||||||
E: Executor<EM, I, S, Z> + HasObservers<I, OT, S>,
|
E: Executor<EM, I, S, Z> + HasObservers<I, OT, S>,
|
||||||
OT: ObserversTuple<I, S>,
|
OT: ObserversTuple<I, S>,
|
||||||
SOT: ObserversTuple<I, S>,
|
SOT: ObserversTuple<I, S>,
|
||||||
S: HasClientPerfStats + HasExecutions + HasCorpus<C, I>,
|
S: HasClientPerfMonitor + HasExecutions + HasCorpus<C, I>,
|
||||||
{
|
{
|
||||||
#[inline]
|
#[inline]
|
||||||
fn perform(
|
fn perform(
|
||||||
@ -169,7 +169,7 @@ where
|
|||||||
E: Executor<EM, I, S, Z> + HasObservers<I, OT, S>,
|
E: Executor<EM, I, S, Z> + HasObservers<I, OT, S>,
|
||||||
OT: ObserversTuple<I, S>,
|
OT: ObserversTuple<I, S>,
|
||||||
SOT: ObserversTuple<I, S>,
|
SOT: ObserversTuple<I, S>,
|
||||||
S: HasClientPerfStats + HasExecutions + HasCorpus<C, I>,
|
S: HasClientPerfMonitor + HasExecutions + HasCorpus<C, I>,
|
||||||
{
|
{
|
||||||
/// Creates a new default stage
|
/// Creates a new default stage
|
||||||
pub fn new(_executor: &mut ShadowExecutor<E, I, S, SOT>) -> Self {
|
pub fn new(_executor: &mut ShadowExecutor<E, I, S, SOT>) -> Self {
|
||||||
|
@ -19,7 +19,7 @@ use crate::{
|
|||||||
fuzzer::{Evaluator, ExecuteInputResult},
|
fuzzer::{Evaluator, ExecuteInputResult},
|
||||||
generators::Generator,
|
generators::Generator,
|
||||||
inputs::Input,
|
inputs::Input,
|
||||||
stats::ClientPerfStats,
|
monitors::ClientPerfMonitor,
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -71,13 +71,13 @@ where
|
|||||||
fn rand_mut(&mut self) -> &mut R;
|
fn rand_mut(&mut self) -> &mut R;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Trait for offering a [`ClientPerfStats`]
|
/// Trait for offering a [`ClientPerfMonitor`]
|
||||||
pub trait HasClientPerfStats {
|
pub trait HasClientPerfMonitor {
|
||||||
/// [`ClientPerfStats`] itself
|
/// [`ClientPerfMonitor`] itself
|
||||||
fn introspection_stats(&self) -> &ClientPerfStats;
|
fn introspection_monitor(&self) -> &ClientPerfMonitor;
|
||||||
|
|
||||||
/// Mutatable ref to [`ClientPerfStats`]
|
/// Mutatable ref to [`ClientPerfMonitor`]
|
||||||
fn introspection_stats_mut(&mut self) -> &mut ClientPerfStats;
|
fn introspection_monitor_mut(&mut self) -> &mut ClientPerfMonitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Trait for elements offering metadata
|
/// Trait for elements offering metadata
|
||||||
@ -166,7 +166,7 @@ where
|
|||||||
|
|
||||||
/// Performance statistics for this fuzzer
|
/// Performance statistics for this fuzzer
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
introspection_stats: ClientPerfStats,
|
introspection_monitor: ClientPerfMonitor,
|
||||||
|
|
||||||
phantom: PhantomData<I>,
|
phantom: PhantomData<I>,
|
||||||
}
|
}
|
||||||
@ -559,14 +559,14 @@ where
|
|||||||
solutions,
|
solutions,
|
||||||
max_size: DEFAULT_MAX_SIZE,
|
max_size: DEFAULT_MAX_SIZE,
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
introspection_stats: ClientPerfStats::new(),
|
introspection_monitor: ClientPerfMonitor::new(),
|
||||||
phantom: PhantomData,
|
phantom: PhantomData,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "introspection")]
|
#[cfg(feature = "introspection")]
|
||||||
impl<C, FT, I, R, SC> HasClientPerfStats for StdState<C, FT, I, R, SC>
|
impl<C, FT, I, R, SC> HasClientPerfMonitor for StdState<C, FT, I, R, SC>
|
||||||
where
|
where
|
||||||
C: Corpus<I>,
|
C: Corpus<I>,
|
||||||
I: Input,
|
I: Input,
|
||||||
@ -574,17 +574,17 @@ where
|
|||||||
FT: FeedbackStatesTuple,
|
FT: FeedbackStatesTuple,
|
||||||
SC: Corpus<I>,
|
SC: Corpus<I>,
|
||||||
{
|
{
|
||||||
fn introspection_stats(&self) -> &ClientPerfStats {
|
fn introspection_monitor(&self) -> &ClientPerfMonitor {
|
||||||
&self.introspection_stats
|
&self.introspection_monitor
|
||||||
}
|
}
|
||||||
|
|
||||||
fn introspection_stats_mut(&mut self) -> &mut ClientPerfStats {
|
fn introspection_monitor_mut(&mut self) -> &mut ClientPerfMonitor {
|
||||||
&mut self.introspection_stats
|
&mut self.introspection_monitor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(feature = "introspection"))]
|
#[cfg(not(feature = "introspection"))]
|
||||||
impl<C, FT, I, R, SC> HasClientPerfStats for StdState<C, FT, I, R, SC>
|
impl<C, FT, I, R, SC> HasClientPerfMonitor for StdState<C, FT, I, R, SC>
|
||||||
where
|
where
|
||||||
C: Corpus<I>,
|
C: Corpus<I>,
|
||||||
I: Input,
|
I: Input,
|
||||||
@ -592,11 +592,11 @@ where
|
|||||||
FT: FeedbackStatesTuple,
|
FT: FeedbackStatesTuple,
|
||||||
SC: Corpus<I>,
|
SC: Corpus<I>,
|
||||||
{
|
{
|
||||||
fn introspection_stats(&self) -> &ClientPerfStats {
|
fn introspection_monitor(&self) -> &ClientPerfMonitor {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn introspection_stats_mut(&mut self) -> &mut ClientPerfStats {
|
fn introspection_monitor_mut(&mut self) -> &mut ClientPerfMonitor {
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ use libafl::{
|
|||||||
feedbacks::Feedback,
|
feedbacks::Feedback,
|
||||||
inputs::{HasTargetBytes, Input},
|
inputs::{HasTargetBytes, Input},
|
||||||
observers::{Observer, ObserversTuple},
|
observers::{Observer, ObserversTuple},
|
||||||
state::{HasClientPerfStats, HasMetadata},
|
state::{HasClientPerfMonitor, HasMetadata},
|
||||||
Error, SerdeAny,
|
Error, SerdeAny,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -614,7 +614,7 @@ pub struct AsanErrorsFeedback {
|
|||||||
impl<I, S> Feedback<I, S> for AsanErrorsFeedback
|
impl<I, S> Feedback<I, S> for AsanErrorsFeedback
|
||||||
where
|
where
|
||||||
I: Input + HasTargetBytes,
|
I: Input + HasTargetBytes,
|
||||||
S: HasClientPerfStats,
|
S: HasClientPerfMonitor,
|
||||||
{
|
{
|
||||||
fn is_interesting<EM, OT>(
|
fn is_interesting<EM, OT>(
|
||||||
&mut self,
|
&mut self,
|
||||||
|
@ -10,7 +10,7 @@ use libafl::{
|
|||||||
fuzzer::HasObjective,
|
fuzzer::HasObjective,
|
||||||
inputs::Input,
|
inputs::Input,
|
||||||
observers::ObserversTuple,
|
observers::ObserversTuple,
|
||||||
state::{HasClientPerfStats, HasSolutions},
|
state::{HasClientPerfMonitor, HasSolutions},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -386,7 +386,7 @@ where
|
|||||||
EM: EventFirer<I, S> + EventRestarter<S>,
|
EM: EventFirer<I, S> + EventRestarter<S>,
|
||||||
OC: Corpus<I>,
|
OC: Corpus<I>,
|
||||||
OF: Feedback<I, S>,
|
OF: Feedback<I, S>,
|
||||||
S: HasSolutions<OC, I> + HasClientPerfStats,
|
S: HasSolutions<OC, I> + HasClientPerfMonitor,
|
||||||
Z: HasObjective<I, OF, S>,
|
Z: HasObjective<I, OF, S>,
|
||||||
{
|
{
|
||||||
let slf = Self {
|
let slf = Self {
|
||||||
|
@ -20,12 +20,12 @@ use libafl::{
|
|||||||
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback, TimeFeedback, TimeoutFeedback},
|
feedbacks::{CrashFeedback, MapFeedbackState, MaxMapFeedback, TimeFeedback, TimeoutFeedback},
|
||||||
fuzzer::{Fuzzer, StdFuzzer},
|
fuzzer::{Fuzzer, StdFuzzer},
|
||||||
generators::RandBytesGenerator,
|
generators::RandBytesGenerator,
|
||||||
|
monitors::MultiMonitor,
|
||||||
mutators::scheduled::{havoc_mutations, tokens_mutations, StdScheduledMutator},
|
mutators::scheduled::{havoc_mutations, tokens_mutations, StdScheduledMutator},
|
||||||
mutators::token_mutations::Tokens,
|
mutators::token_mutations::Tokens,
|
||||||
observers::{ConstMapObserver, HitcountsMapObserver, TimeObserver},
|
observers::{ConstMapObserver, HitcountsMapObserver, TimeObserver},
|
||||||
stages::StdMutationalStage,
|
stages::StdMutationalStage,
|
||||||
state::{HasCorpus, HasMetadata, StdState},
|
state::{HasCorpus, HasMetadata, StdState},
|
||||||
stats::MultiStats,
|
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ impl<'a> ForkserverBytesCoverageSugar<'a> {
|
|||||||
|
|
||||||
let shmem_provider = StdShMemProvider::new().expect("Failed to init shared memory");
|
let shmem_provider = StdShMemProvider::new().expect("Failed to init shared memory");
|
||||||
|
|
||||||
let stats = MultiStats::new(|s| println!("{}", s));
|
let monitor = MultiMonitor::new(|s| println!("{}", s));
|
||||||
|
|
||||||
let mut run_client = |state: Option<StdState<_, _, _, _, _>>, mut mgr, _core_id| {
|
let mut run_client = |state: Option<StdState<_, _, _, _, _>>, mut mgr, _core_id| {
|
||||||
// Coverage map shared between target and fuzzer
|
// Coverage map shared between target and fuzzer
|
||||||
@ -233,7 +233,7 @@ impl<'a> ForkserverBytesCoverageSugar<'a> {
|
|||||||
let launcher = Launcher::builder()
|
let launcher = Launcher::builder()
|
||||||
.shmem_provider(shmem_provider)
|
.shmem_provider(shmem_provider)
|
||||||
.configuration(conf)
|
.configuration(conf)
|
||||||
.stats(stats)
|
.monitor(monitor)
|
||||||
.run_client(&mut run_client)
|
.run_client(&mut run_client)
|
||||||
.cores(self.cores)
|
.cores(self.cores)
|
||||||
.broker_port(self.broker_port)
|
.broker_port(self.broker_port)
|
||||||
|
@ -21,12 +21,12 @@ use libafl::{
|
|||||||
fuzzer::{Fuzzer, StdFuzzer},
|
fuzzer::{Fuzzer, StdFuzzer},
|
||||||
generators::RandBytesGenerator,
|
generators::RandBytesGenerator,
|
||||||
inputs::{BytesInput, HasTargetBytes},
|
inputs::{BytesInput, HasTargetBytes},
|
||||||
|
monitors::MultiMonitor,
|
||||||
mutators::scheduled::{havoc_mutations, tokens_mutations, StdScheduledMutator},
|
mutators::scheduled::{havoc_mutations, tokens_mutations, StdScheduledMutator},
|
||||||
mutators::token_mutations::{I2SRandReplace, Tokens},
|
mutators::token_mutations::{I2SRandReplace, Tokens},
|
||||||
observers::{HitcountsMapObserver, StdMapObserver, TimeObserver},
|
observers::{HitcountsMapObserver, StdMapObserver, TimeObserver},
|
||||||
stages::{ShadowTracingStage, StdMutationalStage},
|
stages::{ShadowTracingStage, StdMutationalStage},
|
||||||
state::{HasCorpus, HasMetadata, StdState},
|
state::{HasCorpus, HasMetadata, StdState},
|
||||||
stats::MultiStats,
|
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ where
|
|||||||
|
|
||||||
let shmem_provider = StdShMemProvider::new().expect("Failed to init shared memory");
|
let shmem_provider = StdShMemProvider::new().expect("Failed to init shared memory");
|
||||||
|
|
||||||
let stats = MultiStats::new(|s| println!("{}", s));
|
let monitor = MultiMonitor::new(|s| println!("{}", s));
|
||||||
|
|
||||||
let mut run_client = |state: Option<StdState<_, _, _, _, _>>, mut mgr, _core_id| {
|
let mut run_client = |state: Option<StdState<_, _, _, _, _>>, mut mgr, _core_id| {
|
||||||
// Create an observation channel using the coverage map
|
// Create an observation channel using the coverage map
|
||||||
@ -254,7 +254,7 @@ where
|
|||||||
let launcher = Launcher::builder()
|
let launcher = Launcher::builder()
|
||||||
.shmem_provider(shmem_provider)
|
.shmem_provider(shmem_provider)
|
||||||
.configuration(conf)
|
.configuration(conf)
|
||||||
.stats(stats)
|
.monitor(monitor)
|
||||||
.run_client(&mut run_client)
|
.run_client(&mut run_client)
|
||||||
.cores(self.cores)
|
.cores(self.cores)
|
||||||
.broker_port(self.broker_port)
|
.broker_port(self.broker_port)
|
||||||
|
@ -21,12 +21,12 @@ use libafl::{
|
|||||||
fuzzer::{Fuzzer, StdFuzzer},
|
fuzzer::{Fuzzer, StdFuzzer},
|
||||||
generators::RandBytesGenerator,
|
generators::RandBytesGenerator,
|
||||||
inputs::{BytesInput, HasTargetBytes},
|
inputs::{BytesInput, HasTargetBytes},
|
||||||
|
monitors::MultiMonitor,
|
||||||
mutators::scheduled::{havoc_mutations, tokens_mutations, StdScheduledMutator},
|
mutators::scheduled::{havoc_mutations, tokens_mutations, StdScheduledMutator},
|
||||||
mutators::{token_mutations::Tokens, I2SRandReplace},
|
mutators::{token_mutations::Tokens, I2SRandReplace},
|
||||||
observers::{HitcountsMapObserver, TimeObserver, VariableMapObserver},
|
observers::{HitcountsMapObserver, TimeObserver, VariableMapObserver},
|
||||||
stages::{ShadowTracingStage, StdMutationalStage},
|
stages::{ShadowTracingStage, StdMutationalStage},
|
||||||
state::{HasCorpus, HasMetadata, StdState},
|
state::{HasCorpus, HasMetadata, StdState},
|
||||||
stats::MultiStats,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pub use libafl_qemu::emu;
|
pub use libafl_qemu::emu;
|
||||||
@ -99,7 +99,7 @@ where
|
|||||||
|
|
||||||
let shmem_provider = StdShMemProvider::new().expect("Failed to init shared memory");
|
let shmem_provider = StdShMemProvider::new().expect("Failed to init shared memory");
|
||||||
|
|
||||||
let stats = MultiStats::new(|s| println!("{}", s));
|
let monitor = MultiMonitor::new(|s| println!("{}", s));
|
||||||
|
|
||||||
let mut run_client = |state: Option<StdState<_, _, _, _, _>>, mut mgr, _core_id| {
|
let mut run_client = |state: Option<StdState<_, _, _, _, _>>, mut mgr, _core_id| {
|
||||||
// Create an observation channel using the coverage map
|
// Create an observation channel using the coverage map
|
||||||
@ -316,7 +316,7 @@ where
|
|||||||
let launcher = Launcher::builder()
|
let launcher = Launcher::builder()
|
||||||
.shmem_provider(shmem_provider)
|
.shmem_provider(shmem_provider)
|
||||||
.configuration(conf)
|
.configuration(conf)
|
||||||
.stats(stats)
|
.monitor(monitor)
|
||||||
.run_client(&mut run_client)
|
.run_client(&mut run_client)
|
||||||
.cores(self.cores)
|
.cores(self.cores)
|
||||||
.broker_port(self.broker_port)
|
.broker_port(self.broker_port)
|
||||||
|
20
scripts/fmt_all.sh
Executable file
20
scripts/fmt_all.sh
Executable file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||||
|
cd "$SCRIPT_DIR/.."
|
||||||
|
|
||||||
|
# TODO: This should be rewritten in rust, a Makefile, or some platform-independent language
|
||||||
|
|
||||||
|
echo "Welcome to the happy fmt script. :)"
|
||||||
|
echo "[*] Running fmt for the main crates"
|
||||||
|
cargo fmt
|
||||||
|
|
||||||
|
cd fuzzers
|
||||||
|
|
||||||
|
for fuzzer in *;
|
||||||
|
do
|
||||||
|
cd $fuzzer
|
||||||
|
echo "[*] Running fmt for $fuzzer"
|
||||||
|
cargo fmt --all
|
||||||
|
cd ..
|
||||||
|
done
|
Loading…
x
Reference in New Issue
Block a user