Trait libafl::stages::Stage

source ·
pub trait Stage<E, EM, Z>: UsesState
where E: UsesState<State = Self::State>, EM: UsesState<State = Self::State>, Z: UsesState<State = Self::State>,
{ // Required methods fn should_restart(&mut self, state: &mut Self::State) -> Result<bool, Error>; fn clear_progress(&mut self, state: &mut Self::State) -> Result<(), Error>; fn perform( &mut self, fuzzer: &mut Z, executor: &mut E, state: &mut Self::State, manager: &mut EM, ) -> Result<(), Error>; // Provided method fn perform_restartable( &mut self, fuzzer: &mut Z, executor: &mut E, state: &mut Self::State, manager: &mut EM, ) -> Result<(), Error> { ... } }
Expand description

A stage is one step in the fuzzing process. Multiple stages will be scheduled one by one for each input.

Required Methods§

source

fn should_restart(&mut self, state: &mut Self::State) -> Result<bool, Error>

This method will be called before every call to Stage::perform. Initialize the restart tracking for this stage, if it is not yet initialized. On restart, this will be called again. As long as Stage::clear_progress, all subsequent calls happen on restart. Returns true, if the stage’s Stage::perform method should run, else false.

source

fn clear_progress(&mut self, state: &mut Self::State) -> Result<(), Error>

Clear the current status tracking of the associated stage

source

fn perform( &mut self, fuzzer: &mut Z, executor: &mut E, state: &mut Self::State, manager: &mut EM, ) -> Result<(), Error>

Run the stage.

Before a call to perform, Stage::should_restart will be (must be!) called. After returning (so non-target crash or timeout in a restarting case), Stage::clear_progress gets called. A call to Stage::perform_restartable will do these things implicitly. DON’T call this function directly except from preform_restartable !!

Provided Methods§

source

fn perform_restartable( &mut self, fuzzer: &mut Z, executor: &mut E, state: &mut Self::State, manager: &mut EM, ) -> Result<(), Error>

Run the stage, calling Stage::should_restart and Stage::clear_progress appropriately

Implementors§

source§

impl<C, E, EM, O, OT, Z> Stage<E, EM, Z> for CalibrationStage<C, E, O, OT>
where E: Executor<EM, Z> + HasObservers<Observers = OT>, EM: EventFirer<State = Self::State>, O: MapObserver, C: AsRef<O>, for<'de> <O as MapObserver>::Entry: Serialize + Deserialize<'de> + 'static, OT: ObserversTuple<Self::State>, Self::State: HasCorpus + HasMetadata + HasNamedMetadata + HasExecutions, Z: Evaluator<E, EM, State = Self::State>,

source§

impl<C, E, EM, O, Z> Stage<E, EM, Z> for ColorizationStage<C, E, EM, O, Z>
where EM: UsesState<State = Self::State> + EventFirer, E: HasObservers + Executor<EM, Z>, Self::State: HasCorpus + HasMetadata + HasRand + HasNamedMetadata, E::Input: HasMutatorBytes, O: MapObserver, C: AsRef<O> + Named, Z: UsesState<State = Self::State>,

source§

impl<C, E, EM, O, Z> Stage<E, EM, Z> for GeneralizationStage<C, EM, O, E::Observers, Z>
where O: MapObserver, C: CanTrack + AsRef<O> + Named, E: Executor<EM, Z, State = Self::State> + HasObservers, Self::State: UsesInput<Input = BytesInput> + HasExecutions + HasMetadata + HasCorpus + HasNamedMetadata, EM: UsesState, Z: UsesState<State = Self::State>,

source§

impl<CB, E, EM, ST1, ST2, Z> Stage<E, EM, Z> for IfElseStage<CB, E, EM, ST1, ST2, Z>
where CB: FnMut(&mut Z, &mut E, &mut Self::State, &mut EM) -> Result<bool, Error>, E: UsesState, EM: UsesState<State = Self::State>, ST1: StagesTuple<E, EM, Self::State, Z>, ST2: StagesTuple<E, EM, Self::State, Z>, Z: UsesState<State = Self::State>, Self::State: HasNestedStageStatus,

source§

impl<CB, E, EM, ST, Z> Stage<E, EM, Z> for IfStage<CB, E, EM, ST, Z>
where CB: FnMut(&mut Z, &mut E, &mut Self::State, &mut EM) -> Result<bool, Error>, E: UsesState, EM: UsesState<State = Self::State>, ST: StagesTuple<E, EM, Self::State, Z>, Z: UsesState<State = Self::State>, Self::State: HasNestedStageStatus,

source§

impl<CB, E, EM, ST, Z> Stage<E, EM, Z> for WhileStage<CB, E, EM, ST, Z>
where CB: FnMut(&mut Z, &mut E, &mut Self::State, &mut EM) -> Result<bool, Error>, E: UsesState, EM: UsesState<State = E::State>, ST: StagesTuple<E, EM, Self::State, Z>, Z: UsesState<State = Self::State>, Self::State: HasNestedStageStatus,

source§

impl<CB, E, EM, Z> Stage<E, EM, Z> for DumpToDiskStage<CB, EM, Z>
where CB: FnMut(&<Self::State as UsesInput>::Input, &Self::State) -> Vec<u8>, EM: UsesState, E: UsesState<State = Self::State>, Z: UsesState<State = Self::State>, Self::State: HasCorpus + HasSolutions + HasRand + HasMetadata,

source§

impl<CB, E, EM, Z> Stage<E, EM, Z> for ClosureStage<CB, E, EM, Z>
where CB: FnMut(&mut Z, &mut E, &mut Self::State, &mut EM) -> Result<(), Error>, E: UsesState, EM: UsesState<State = Self::State>, Z: UsesState<State = Self::State>, Self::State: HasNamedMetadata,

source§

impl<CB, E, EM, Z> Stage<E, EM, Z> for SyncFromDiskStage<CB, E, EM, Z>
where CB: FnMut(&mut Z, &mut Self::State, &Path) -> Result<<Self::State as UsesInput>::Input, Error>, E: UsesState<State = Self::State>, EM: UsesState<State = Self::State>, Z: Evaluator<E, EM>, Self::State: HasCorpus + HasRand + HasMetadata + HasNamedMetadata,

source§

impl<CS, E, EM, OT, PS, Z> Stage<E, EM, Z> for PushStageAdapter<CS, EM, OT, PS, Z>
where CS: Scheduler, Self::State: HasExecutions + HasRand + HasCorpus + HasLastReportTime + HasCurrentCorpusId + HasNamedMetadata + HasMetadata, E: Executor<EM, Z> + HasObservers<Observers = OT, State = Self::State>, EM: EventFirer<State = Self::State> + EventRestarter + HasEventManagerId + ProgressReporter<State = Self::State>, OT: ObserversTuple<Self::State>, PS: PushStage<CS, EM, OT, Z>, Z: ExecutesInput<E, EM, State = Self::State> + ExecutionProcessor<OT, State = Self::State> + EvaluatorObservers<OT> + HasScheduler<Scheduler = CS>,

source§

impl<E, EM, F, FF, IP, M, Z> Stage<E, EM, Z> for StdTMinMutationalStage<E, EM, F, FF, IP, M, Z>

source§

impl<E, EM, I, M, Z> Stage<E, EM, Z> for MultiMutationalStage<E, EM, I, M, Z>
where E: UsesState<State = Self::State>, EM: UsesState<State = Self::State>, M: MultiMutator<I, Self::State>, Z: Evaluator<E, EM>, Self::State: HasCorpus + HasRand + HasNamedMetadata, I: MutatedTransform<Self::Input, Self::State> + Clone,

source§

impl<E, EM, I, M, Z> Stage<E, EM, Z> for StdMutationalStage<E, EM, I, M, Z>
where E: UsesState<State = Self::State>, EM: UsesState<State = Self::State>, M: Mutator<I, Self::State>, Z: Evaluator<E, EM>, Self::State: HasCorpus + HasRand + HasMetadata + HasExecutions + HasNamedMetadata, I: MutatedTransform<Self::Input, Self::State> + Clone,

source§

impl<E, EM, I, M, Z> Stage<E, EM, Z> for TuneableMutationalStage<E, EM, I, M, Z>
where E: UsesState<State = Self::State>, EM: UsesState<State = Self::State>, M: Mutator<I, Self::State>, Z: Evaluator<E, EM>, Self::State: HasCorpus + HasRand + HasNamedMetadata + HasMetadata + HasExecutions, I: MutatedTransform<Self::Input, Self::State> + Clone,

source§

impl<E, EM, IC, ICB, DI, S, SP, Z> Stage<E, EM, Z> for SyncFromBrokerStage<DI, IC, ICB, S, SP>
where EM: UsesState<State = S> + EventFirer, S: State + HasExecutions + HasCorpus + HasRand + HasMetadata + HasTestcase, SP: ShMemProvider, E: HasObservers<State = S> + Executor<EM, Z>, for<'a> E::Observers: Deserialize<'a>, Z: EvaluatorObservers<E::Observers, State = S> + ExecutionProcessor<E::Observers, State = S>, IC: InputConverter<From = S::Input, To = DI>, ICB: InputConverter<From = DI, To = S::Input>, DI: Input,

source§

impl<E, EM, SOT, Z> Stage<ShadowExecutor<E, SOT>, EM, Z> for ShadowTracingStage<E, EM, SOT, Z>
where E: Executor<EM, Z> + HasObservers, EM: UsesState<State = <Self as UsesState>::State>, SOT: ObserversTuple<E::State>, Z: UsesState<State = <Self as UsesState>::State>, <Self as UsesState>::State: State + HasExecutions + HasCorpus + HasNamedMetadata + Debug,

source§

impl<E, EM, ST, Z> Stage<E, EM, Z> for OptionalStage<E, EM, ST, Z>
where E: UsesState, EM: UsesState<State = Self::State>, ST: StagesTuple<E, EM, Self::State, Z>, Z: UsesState<State = Self::State>, Self::State: HasNestedStageStatus,

source§

impl<E, EM, TE, Z> Stage<E, EM, Z> for ConcolicTracingStage<'_, EM, TE, Z>
where E: UsesState<State = Self::State>, EM: UsesState<State = Self::State>, TE: Executor<EM, Z> + HasObservers, Self::State: HasExecutions + HasCorpus + HasNamedMetadata, Z: UsesState<State = Self::State>,

source§

impl<E, EM, TE, Z> Stage<E, EM, Z> for TracingStage<EM, TE, Z>
where E: UsesState<State = <Self as UsesState>::State>, TE: Executor<EM, Z> + HasObservers, <Self as UsesState>::State: HasExecutions + HasCorpus + HasNamedMetadata, EM: UsesState<State = <Self as UsesState>::State>, Z: UsesState<State = <Self as UsesState>::State>,

source§

impl<E, EM, Z> Stage<E, EM, Z> for SimpleConcolicMutationalStage<Z>
where E: UsesState<State = Self::State>, EM: UsesState<State = Self::State>, Z: Evaluator<E, EM>, Z::Input: HasMutatorBytes, Self::State: State + HasExecutions + HasCorpus + HasMetadata + HasNamedMetadata,

source§

impl<E, EM, Z> Stage<E, EM, Z> for AflStatsStage<E, EM, Z>
where E: UsesState, EM: EventFirer<State = Self::State>, Z: UsesState<State = Self::State>, Self::State: HasImported + HasCorpus + HasMetadata,

source§

impl<E, EM, Z, G> Stage<E, EM, Z> for GenStage<G, Z>
where E: UsesState<State = Self::State>, EM: UsesState<State = Self::State>, Z: Evaluator<E, EM>, Self::State: HasCorpus + HasRand, G: Generator<<<Self as UsesState>::State as UsesInput>::Input, Self::State>,

source§

impl<E, F, EM, I, M, Z> Stage<E, EM, Z> for PowerMutationalStage<E, F, EM, I, M, Z>
where E: Executor<EM, Z> + HasObservers, EM: UsesState<State = Self::State>, F: TestcaseScore<Self::State>, M: Mutator<I, Self::State>, Self::State: HasCorpus + HasMetadata + HasRand + HasExecutions + HasNamedMetadata, Z: Evaluator<E, EM, State = Self::State>, I: MutatedTransform<Self::Input, Self::State> + Clone,

source§

impl<S, E, EM, Z> Stage<E, EM, Z> for UnicodeIdentificationStage<S>
where S: HasTestcase<Input = BytesInput> + HasCorpus + State, E: UsesState<State = S>, EM: UsesState<State = S>, Z: UsesState<State = S>,