diff --git a/libafl/src/mutators/mod.rs b/libafl/src/mutators/mod.rs index 8498b700ea..3bbd89d98b 100644 --- a/libafl/src/mutators/mod.rs +++ b/libafl/src/mutators/mod.rs @@ -22,16 +22,18 @@ where I: Input, { /// Mutate a given input - fn mutate( + fn mutate( &mut self, + fuzzer: &F, state: &mut S, input: &mut I, stage_idx: i32, ) -> Result<(), Error>; /// Post-process given the outcome of the execution - fn post_exec( + fn post_exec( &mut self, + _fuzzer: &F, _state: &mut S, _is_interesting: u32, _stage_idx: i32, diff --git a/libafl/src/mutators/mutations.rs b/libafl/src/mutators/mutations.rs index 19f72ebeae..8cd1b52bc0 100644 --- a/libafl/src/mutators/mutations.rs +++ b/libafl/src/mutators/mutations.rs @@ -27,21 +27,21 @@ pub enum MutationResult { // TODO maybe the mutator arg is not needed /// The generic function type that identifies mutations -pub type MutationFunction = - fn(&mut M, &mut S, &mut I) -> Result; +pub type MutationFunction = + fn(&mut M, &F, &mut S, &mut I) -> Result; -pub trait ComposedByMutations +pub trait ComposedByMutations where I: Input, { /// Get a mutation by index - fn mutation_by_idx(&self, index: usize) -> MutationFunction; + fn mutation_by_idx(&self, index: usize) -> MutationFunction; /// Get the number of mutations fn mutations_count(&self) -> usize; /// Add a mutation - fn add_mutation(&mut self, mutation: MutationFunction); + fn add_mutation(&mut self, mutation: MutationFunction); } /// Mem move in the own vec @@ -939,6 +939,7 @@ pub fn read_tokens_file(f: &str, tokens: &mut Vec>) -> Result( &mut self, + fuzzer: &F, state: &mut S, input: &mut I, _stage_idx: i32, diff --git a/libafl/src/stages/mod.rs b/libafl/src/stages/mod.rs index dda5bb1ed0..940b7d7c71 100644 --- a/libafl/src/stages/mod.rs +++ b/libafl/src/stages/mod.rs @@ -17,10 +17,11 @@ where I: Input { /// Run the stage - fn perform( + fn perform( &self, - executor: &mut E, + fuzzer: &F, state: &mut S, + executor: &mut E, manager: &mut EM, corpus_idx: usize, ) -> Result<(), Error> @@ -33,10 +34,11 @@ pub trait StagesTuple where I: Input { - fn perform_all( + fn perform_all( &self, - executor: &mut E, + fuzzer: &F, state: &mut S, + executor: &mut E, manager: &mut EM, corpus_idx: usize, ) -> Result<(), Error> @@ -49,10 +51,11 @@ impl StagesTuple for () where I: Input { - fn perform_all( + fn perform_all( &self, - executor: &mut E, + fuzzer: &F, state: &mut S, + executor: &mut E, manager: &mut EM, corpus_idx: usize, ) -> Result<(), Error> @@ -70,10 +73,11 @@ where Tail: StagesTuple + TupleList, I: Input { - fn perform_all( + fn perform_all( &self, - executor: &mut E, + fuzzer: &F, state: &mut S, + executor: &mut E, manager: &mut EM, corpus_idx: usize, ) -> Result<(), Error> @@ -81,7 +85,7 @@ where EM: EventManager, E: Executor { - self.0.perform(executor, state, manager, corpus_idx)?; - self.1 .perform_all(executor, state, manager, corpus_idx) + self.0.perform(fuzzer, state, executor, manager, corpus_idx)?; + self.1 .perform_all(fuzzer, state, executor, manager, corpus_idx) } } diff --git a/libafl/src/stages/mutational.rs b/libafl/src/stages/mutational.rs index 2e292912ce..c45574446d 100644 --- a/libafl/src/stages/mutational.rs +++ b/libafl/src/stages/mutational.rs @@ -33,10 +33,11 @@ where fn iterations(&mut self, state: &mut S) -> usize; /// Runs this (mutational) stage for the given testcase - fn perform_mutational( + fn perform_mutational( &self, - executor: &mut E, + fuzzer: &F, state: &mut S, + executor: &mut E, manager: &mut EM, corpus_idx: usize, ) -> Result<(), Error> @@ -111,10 +112,11 @@ where I: Input, { #[inline] - fn perform( + fn perform( &self, - executor: &mut E, + fuzzer: &F, state: &mut S, + executor: &mut E, manager: &mut EM, corpus_idx: usize, ) -> Result<(), Error> @@ -124,7 +126,7 @@ where S: HasCorpus + Evaluator, C: Corpus { - self.perform_mutational(executor, state, manager, corpus_idx) + self.perform_mutational(fuzzer, state, executor, manager, corpus_idx) } }