diff --git a/fuzzers/baby/tutorial/src/mutator.rs b/fuzzers/baby/tutorial/src/mutator.rs index 46bc7a7248..d281301209 100644 --- a/fuzzers/baby/tutorial/src/mutator.rs +++ b/fuzzers/baby/tutorial/src/mutator.rs @@ -2,6 +2,7 @@ use std::borrow::Cow; use lain::traits::Mutatable; use libafl::{ + corpus::CorpusId, mutators::{MutationResult, Mutator}, state::HasRand, Error, @@ -27,6 +28,11 @@ where input.mutate(&mut self.inner, None); Ok(MutationResult::Mutated) } + + #[inline] + fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option) -> Result<(), Error> { + Ok(()) + } } impl Named for LainMutator { diff --git a/fuzzers/structure_aware/baby_fuzzer_custom_input/src/input.rs b/fuzzers/structure_aware/baby_fuzzer_custom_input/src/input.rs index d531e584ca..13d8504981 100644 --- a/fuzzers/structure_aware/baby_fuzzer_custom_input/src/input.rs +++ b/fuzzers/structure_aware/baby_fuzzer_custom_input/src/input.rs @@ -2,6 +2,7 @@ use core::num::NonZeroUsize; use std::{borrow::Cow, hash::Hash}; use libafl::{ + corpus::CorpusId, generators::{Generator, RandBytesGenerator}, inputs::{BytesInput, HasTargetBytes, Input}, mutators::{MutationResult, Mutator}, @@ -125,6 +126,10 @@ where }; Ok(MutationResult::Mutated) } + #[inline] + fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option) -> Result<(), Error> { + Ok(()) + } } impl Named for ToggleOptionalByteArrayMutator { @@ -141,6 +146,11 @@ impl Mutator for ToggleBooleanMutator { input.boolean = !input.boolean; Ok(MutationResult::Mutated) } + + #[inline] + fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option) -> Result<(), Error> { + Ok(()) + } } impl Named for ToggleBooleanMutator { diff --git a/libafl/src/monitors/tui/mod.rs b/libafl/src/monitors/tui/mod.rs index ec2adb90a2..e4067f455b 100644 --- a/libafl/src/monitors/tui/mod.rs +++ b/libafl/src/monitors/tui/mod.rs @@ -281,7 +281,6 @@ pub struct TuiContext { pub total_map_density: String, pub total_solutions: u64, - pub total_cycles_done: u64, pub total_corpus_count: u64, pub total_process_timing: ProcessTiming, @@ -310,7 +309,6 @@ impl TuiContext { total_map_density: "0%".to_string(), total_solutions: 0, - total_cycles_done: 0, total_corpus_count: 0, total_item_geometry: ItemGeometry::new(), total_process_timing: ProcessTiming::new(), @@ -374,7 +372,6 @@ impl Monitor for TuiMonitor { edges_total, }| format!("{}%", edges_hit * 100 / edges_total), ); - ctx.total_cycles_done = 0; ctx.total_item_geometry = client_stats_manager.item_geometry(); } diff --git a/libafl/src/monitors/tui/ui.rs b/libafl/src/monitors/tui/ui.rs index b42ff6981a..9e4da038f1 100644 --- a/libafl/src/monitors/tui/ui.rs +++ b/libafl/src/monitors/tui/ui.rs @@ -602,8 +602,6 @@ impl TuiUi { Row::new(vec![ Cell::from(Span::raw("solutions")), Cell::from(Span::raw(format_big_number(app.total_solutions))), - Cell::from(Span::raw("cycle done")), - Cell::from(Span::raw(format_big_number(app.total_cycles_done))), Cell::from(Span::raw("corpus count")), Cell::from(Span::raw(format_big_number(app.total_corpus_count))), ]), diff --git a/libafl/src/mutators/encoded_mutations.rs b/libafl/src/mutators/encoded_mutations.rs index a3a02c9657..48e88570dc 100644 --- a/libafl/src/mutators/encoded_mutations.rs +++ b/libafl/src/mutators/encoded_mutations.rs @@ -36,6 +36,14 @@ impl Mutator for EncodedRandMutator { Ok(MutationResult::Mutated) } } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for EncodedRandMutator { @@ -67,6 +75,14 @@ impl Mutator for EncodedIncMutator { Ok(MutationResult::Mutated) } } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for EncodedIncMutator { @@ -98,6 +114,14 @@ impl Mutator for EncodedDecMutator { Ok(MutationResult::Mutated) } } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for EncodedDecMutator { @@ -133,6 +157,14 @@ impl Mutator for EncodedAddMutator { Ok(MutationResult::Mutated) } } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for EncodedAddMutator { @@ -174,6 +206,14 @@ impl Mutator for EncodedDeleteMutator { Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for EncodedDeleteMutator { @@ -241,6 +281,14 @@ where Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for EncodedInsertCopyMutator { @@ -289,6 +337,14 @@ impl Mutator for EncodedCopyMutator { Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for EncodedCopyMutator { @@ -372,6 +428,14 @@ where Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for EncodedCrossoverInsertMutator { @@ -445,6 +509,14 @@ where Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for EncodedCrossoverReplaceMutator { diff --git a/libafl/src/mutators/gramatron.rs b/libafl/src/mutators/gramatron.rs index 58412723fa..b36f1ad61e 100644 --- a/libafl/src/mutators/gramatron.rs +++ b/libafl/src/mutators/gramatron.rs @@ -56,6 +56,14 @@ where Ok(MutationResult::Skipped) } } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for GramatronRandomMutator<'_, S> @@ -158,6 +166,14 @@ where }, ) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for GramatronSpliceMutator { @@ -267,6 +283,14 @@ where Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for GramatronRecursionMutator { diff --git a/libafl/src/mutators/grimoire.rs b/libafl/src/mutators/grimoire.rs index 0ccc31395b..91143d7a5d 100644 --- a/libafl/src/mutators/grimoire.rs +++ b/libafl/src/mutators/grimoire.rs @@ -139,6 +139,14 @@ where &mut self.gap_indices, ) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for GrimoireExtensionMutator { @@ -219,6 +227,14 @@ where Ok(mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for GrimoireRecursiveReplacementMutator { @@ -343,6 +359,14 @@ where Ok(mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for GrimoireStringReplacementMutator { @@ -410,6 +434,14 @@ where Ok(result) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for GrimoireRandomDeleteMutator { diff --git a/libafl/src/mutators/hash.rs b/libafl/src/mutators/hash.rs index 7c53105e93..cce5b597d1 100644 --- a/libafl/src/mutators/hash.rs +++ b/libafl/src/mutators/hash.rs @@ -40,6 +40,14 @@ where Ok(MutationResult::Mutated) } } + #[inline] + fn post_exec( + &mut self, + state: &mut S, + new_corpus_id: Option, + ) -> Result<(), Error> { + self.inner.post_exec(state, new_corpus_id) + } } impl Named for MutationChecker { diff --git a/libafl/src/mutators/list.rs b/libafl/src/mutators/list.rs index f84e5d7144..7278ce6f00 100644 --- a/libafl/src/mutators/list.rs +++ b/libafl/src/mutators/list.rs @@ -60,6 +60,14 @@ where input.append_part(generated); Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for GenerateToAppendMutator { @@ -88,6 +96,14 @@ where None => Ok(MutationResult::Skipped), } } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for RemoveLastEntryMutator { @@ -123,6 +139,14 @@ where } } } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for RemoveRandomEntryMutator { @@ -168,6 +192,14 @@ where input.insert_part(current_idx, (key, part)); Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for CrossoverInsertMutator { @@ -214,6 +246,14 @@ where input.insert_part(current_idx, (key, part)); Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for CrossoverReplaceMutator { diff --git a/libafl/src/mutators/mapping.rs b/libafl/src/mutators/mapping.rs index fed396ea57..bdc064348d 100644 --- a/libafl/src/mutators/mapping.rs +++ b/libafl/src/mutators/mapping.rs @@ -73,6 +73,14 @@ where fn mutate(&mut self, state: &mut S, input: &mut IO) -> Result { self.inner.mutate(state, (self.mapper)(input)) } + #[inline] + fn post_exec( + &mut self, + state: &mut S, + new_corpus_id: Option, + ) -> Result<(), Error> { + self.inner.post_exec(state, new_corpus_id) + } } impl Named for MappingMutator { @@ -202,6 +210,14 @@ where Some(i) => self.inner.mutate(state, i), } } + #[inline] + fn post_exec( + &mut self, + state: &mut S, + new_corpus_id: Option, + ) -> Result<(), Error> { + self.inner.post_exec(state, new_corpus_id) + } } impl Named for OptionalMutator diff --git a/libafl/src/mutators/mod.rs b/libafl/src/mutators/mod.rs index 6b4bd35bc6..4a0776bba1 100644 --- a/libafl/src/mutators/mod.rs +++ b/libafl/src/mutators/mod.rs @@ -111,10 +111,7 @@ pub trait Mutator: Named { /// Post-process given the outcome of the execution /// `new_corpus_id` will be `Some` if a new [`crate::corpus::Testcase`] was created this execution. - #[inline] - fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option) -> Result<(), Error> { - Ok(()) - } + fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option) -> Result<(), Error>; } /// A mutator that takes input, and returns a vector of mutated inputs. @@ -400,6 +397,10 @@ impl Mutator for NopMutator { fn mutate(&mut self, _state: &mut S, _input: &mut I) -> Result { Ok(self.result) } + #[inline] + fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option) -> Result<(), Error> { + Ok(()) + } } impl Named for NopMutator { @@ -419,6 +420,10 @@ impl Mutator for BoolInvertMutator { *input = !*input; Ok(MutationResult::Mutated) } + #[inline] + fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option) -> Result<(), Error> { + Ok(()) + } } impl Named for BoolInvertMutator { diff --git a/libafl/src/mutators/multi.rs b/libafl/src/mutators/multi.rs index 79ec049929..f5a31c882d 100644 --- a/libafl/src/mutators/multi.rs +++ b/libafl/src/mutators/multi.rs @@ -255,6 +255,10 @@ where Ok(MutationResult::Mutated) } } + #[inline] + fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option) -> Result<(), Error> { + Ok(()) + } } impl Mutator, S> for BytesInputCrossoverReplaceMutator @@ -389,4 +393,8 @@ where Ok(MutationResult::Mutated) } } + #[inline] + fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option) -> Result<(), Error> { + Ok(()) + } } diff --git a/libafl/src/mutators/mutations.rs b/libafl/src/mutators/mutations.rs index 5b3d1373de..bc3f332b1c 100644 --- a/libafl/src/mutators/mutations.rs +++ b/libafl/src/mutators/mutations.rs @@ -141,6 +141,14 @@ where Ok(MutationResult::Mutated) } } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for BitFlipMutator { @@ -175,6 +183,14 @@ where Ok(MutationResult::Mutated) } } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for ByteFlipMutator { @@ -210,6 +226,14 @@ where Ok(MutationResult::Mutated) } } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for ByteIncMutator { @@ -245,6 +269,14 @@ where Ok(MutationResult::Mutated) } } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for ByteDecMutator { @@ -280,6 +312,14 @@ where Ok(MutationResult::Mutated) } } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for ByteNegMutator { @@ -315,6 +355,14 @@ where Ok(MutationResult::Mutated) } } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for ByteRandMutator { @@ -376,6 +424,10 @@ macro_rules! add_mutator_impl { Ok(MutationResult::Mutated) } } + #[inline] + fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option) -> Result<(), Error> { + Ok(()) + } } impl Named for $name { @@ -434,6 +486,14 @@ macro_rules! interesting_mutator_impl { Ok(MutationResult::Mutated) } } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for $name { @@ -482,6 +542,14 @@ where Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for BytesDeleteMutator { @@ -533,6 +601,14 @@ where Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for BytesExpandMutator { @@ -601,6 +677,14 @@ where Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for BytesInsertMutator { @@ -664,6 +748,14 @@ where Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for BytesRandInsertMutator { @@ -707,6 +799,14 @@ where Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for BytesSetMutator { @@ -750,6 +850,14 @@ where Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for BytesRandSetMutator { @@ -799,6 +907,14 @@ where Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for BytesCopyMutator { @@ -875,6 +991,14 @@ where } Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for BytesInsertCopyMutator { @@ -1090,6 +1214,14 @@ where Ok(MutationResult::Skipped) } } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for BytesSwapMutator { @@ -1201,6 +1333,14 @@ where other.mutator_bytes(), )) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for CrossoverInsertMutator { @@ -1296,6 +1436,14 @@ where other.mutator_bytes(), )) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for CrossoverReplaceMutator { @@ -1409,6 +1557,14 @@ where mapped_other_input, )) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for MappedCrossoverInsertMutator { @@ -1495,6 +1651,14 @@ where mapped_other_input, )) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for MappedCrossoverReplaceMutator { @@ -1565,6 +1729,14 @@ where Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for SpliceMutator { diff --git a/libafl/src/mutators/nautilus.rs b/libafl/src/mutators/nautilus.rs index 10d3eaec62..614803e229 100644 --- a/libafl/src/mutators/nautilus.rs +++ b/libafl/src/mutators/nautilus.rs @@ -62,6 +62,14 @@ impl Mutator for NautilusRandomMutator<'_> { Ok(MutationResult::Mutated) } } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for NautilusRandomMutator<'_> { @@ -127,6 +135,14 @@ impl Mutator for NautilusRecursionMutator<'_> { } Ok(MutationResult::Skipped) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for NautilusRecursionMutator<'_> { @@ -198,6 +214,14 @@ where Ok(MutationResult::Mutated) } } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for NautilusSpliceMutator<'_> { diff --git a/libafl/src/mutators/numeric.rs b/libafl/src/mutators/numeric.rs index 6a4c92e93b..f5ac9ba00f 100644 --- a/libafl/src/mutators/numeric.rs +++ b/libafl/src/mutators/numeric.rs @@ -252,6 +252,14 @@ where input.flip_bit_at(offset); Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for BitFlipMutator { @@ -272,6 +280,14 @@ where input.flip_all_bits(); Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for NegateMutator { @@ -292,6 +308,14 @@ where input.wrapping_inc(); Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for IncMutator { @@ -312,6 +336,14 @@ where input.wrapping_dec(); Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for DecMutator { @@ -332,6 +364,14 @@ where input.twos_complement(); Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for TwosComplementMutator { @@ -354,6 +394,14 @@ where input.randomize(state.rand_mut()); Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for RandMutator { @@ -382,6 +430,14 @@ where *input = *other_testcase.input().as_ref().unwrap(); Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for CrossoverMutator { @@ -425,6 +481,14 @@ where *input = mapped_input; Ok(MutationResult::Mutated) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl Named for MappedCrossoverMutator { diff --git a/libafl/src/mutators/scheduled.rs b/libafl/src/mutators/scheduled.rs index e2f9d17344..010e5812c9 100644 --- a/libafl/src/mutators/scheduled.rs +++ b/libafl/src/mutators/scheduled.rs @@ -119,6 +119,10 @@ where fn mutate(&mut self, state: &mut S, input: &mut I) -> Result { self.scheduled_mutate(state, input) } + #[inline] + fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option) -> Result<(), Error> { + Ok(()) + } } impl ComposedByMutations for SingleChoiceScheduledMutator { @@ -197,6 +201,10 @@ where fn mutate(&mut self, state: &mut S, input: &mut I) -> Result { self.scheduled_mutate(state, input) } + #[inline] + fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option) -> Result<(), Error> { + Ok(()) + } } impl ComposedByMutations for HavocScheduledMutator { diff --git a/libafl/src/mutators/token_mutations.rs b/libafl/src/mutators/token_mutations.rs index 53f41ce4cb..743a11e692 100644 --- a/libafl/src/mutators/token_mutations.rs +++ b/libafl/src/mutators/token_mutations.rs @@ -352,6 +352,10 @@ where Ok(MutationResult::Mutated) } + #[inline] + fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option) -> Result<(), Error> { + Ok(()) + } } impl Named for TokenInsert { @@ -412,6 +416,10 @@ where Ok(MutationResult::Mutated) } + #[inline] + fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option) -> Result<(), Error> { + Ok(()) + } } impl Named for TokenReplace { @@ -599,6 +607,10 @@ where Ok(result) } + #[inline] + fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option) -> Result<(), Error> { + Ok(()) + } } impl Named for I2SRandReplace { @@ -807,6 +819,10 @@ where Ok(result) } + #[inline] + fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option) -> Result<(), Error> { + Ok(()) + } } impl Named for I2SRandReplaceBinonly { diff --git a/libafl/src/mutators/tuneable.rs b/libafl/src/mutators/tuneable.rs index d980e651fd..10e6644309 100644 --- a/libafl/src/mutators/tuneable.rs +++ b/libafl/src/mutators/tuneable.rs @@ -95,6 +95,14 @@ where fn mutate(&mut self, state: &mut S, input: &mut I) -> Result { self.scheduled_mutate(state, input) } + #[inline] + fn post_exec( + &mut self, + _state: &mut S, + _new_corpus_id: Option, + ) -> Result<(), Error> { + Ok(()) + } } impl ComposedByMutations for TuneableScheduledMutator { diff --git a/libafl/src/mutators/unicode/mod.rs b/libafl/src/mutators/unicode/mod.rs index 66d3e22132..618acab409 100644 --- a/libafl/src/mutators/unicode/mod.rs +++ b/libafl/src/mutators/unicode/mod.rs @@ -334,6 +334,10 @@ where Ok(MutationResult::Skipped) } + #[inline] + fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option) -> Result<(), Error> { + Ok(()) + } } /// Mutator which randomly replaces a randomly selected range of bytes with bytes that preserve the @@ -385,6 +389,10 @@ where Ok(MutationResult::Skipped) } + #[inline] + fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option) -> Result<(), Error> { + Ok(()) + } } /// Mutator which randomly replaces a full category-contiguous region of chars with a random token @@ -444,6 +452,10 @@ where Ok(MutationResult::Skipped) } + #[inline] + fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option) -> Result<(), Error> { + Ok(()) + } } /// Mutator which randomly replaces a full subcategory-contiguous region of chars with a random token @@ -503,6 +515,10 @@ where Ok(MutationResult::Skipped) } + #[inline] + fn post_exec(&mut self, _state: &mut S, _new_corpus_id: Option) -> Result<(), Error> { + Ok(()) + } } #[cfg(test)] diff --git a/libafl_targets/src/libfuzzer/mutators.rs b/libafl_targets/src/libfuzzer/mutators.rs index 3e7ad39fb1..100bc10a6b 100644 --- a/libafl_targets/src/libfuzzer/mutators.rs +++ b/libafl_targets/src/libfuzzer/mutators.rs @@ -5,7 +5,7 @@ use alloc::{ vec::Vec, }; use core::{cell::RefCell, marker::PhantomData, ops::Deref}; - +use libafl::corpus::CorpusId; use libafl::{ Error, corpus::Corpus, @@ -302,6 +302,10 @@ where fn mutate(&mut self, state: &mut S, input: &mut BytesInput) -> Result { self.scheduled_mutate(state, input) } + #[inline] + fn post_exec(&mut self, state: &mut S, new_corpus_id: Option) -> Result<(), Error> { + self.mutator.deref().borrow_mut().post_exec(state, new_corpus_id) + } } impl ScheduledMutator for LLVMCustomMutator @@ -381,6 +385,10 @@ where fn mutate(&mut self, state: &mut S, input: &mut BytesInput) -> Result { self.scheduled_mutate(state, input) } + #[inline] + fn post_exec(&mut self, state: &mut S, new_corpus_id: Option) -> Result<(), Error> { + self.mutator.deref().borrow_mut().post_exec(state, new_corpus_id) + } } impl ScheduledMutator for LLVMCustomMutator