diff --git a/libafl/src/corpus/minimizer.rs b/libafl/src/corpus/minimizer.rs index 0e513863df..321124494c 100644 --- a/libafl/src/corpus/minimizer.rs +++ b/libafl/src/corpus/minimizer.rs @@ -38,7 +38,6 @@ pub type StdCorpusMinimizer = MapCorpusMinimizer MapCorpusMinimizer where - E: UsesState, E::State: HasCorpus + HasMetadata, TS: TestcaseScore, C: Named, @@ -55,7 +54,6 @@ where impl MapCorpusMinimizer where - E: UsesState, for<'a> O: MapObserver + AsIter<'a, Item = T>, C: AsRef, E::State: HasMetadata + HasCorpus + HasExecutions, diff --git a/libafl/src/events/centralized.rs b/libafl/src/events/centralized.rs index 9d818e8686..d61dc76172 100644 --- a/libafl/src/events/centralized.rs +++ b/libafl/src/events/centralized.rs @@ -367,7 +367,7 @@ impl EventProcessor for CentralizedEventManager + EventFirer + HasEventManagerId, EMH: EventManagerHooksTuple, - E: HasObservers + Executor, + E: HasObservers + Executor::Input, S, Z>, E::Observers: ObserversTuple<::Input, ::State> + Serialize, for<'a> E::Observers: Deserialize<'a>, @@ -402,7 +402,7 @@ where impl EventManager for CentralizedEventManager where - E: HasObservers + Executor, + E: HasObservers + Executor::Input, S, Z>, E::Observers: ObserversTuple<::Input, ::State> + Serialize, for<'a> E::Observers: Deserialize<'a>, @@ -532,7 +532,7 @@ where executor: &mut E, ) -> Result where - E: Executor::State> + HasObservers, + E: Executor::Input, S, Z> + HasObservers, E::Observers: ObserversTuple<::Input, ::State> + Serialize, ::State: UsesInput + HasExecutions + HasMetadata, @@ -582,7 +582,7 @@ where event: Event<<::State as UsesInput>::Input>, ) -> Result<(), Error> where - E: Executor::State> + HasObservers, + E: Executor::Input, S, Z> + HasObservers, E::Observers: ObserversTuple<::Input, ::State> + Serialize, ::State: UsesInput + HasExecutions + HasMetadata, diff --git a/libafl/src/events/llmp/mgr.rs b/libafl/src/events/llmp/mgr.rs index 5fac3c07e5..ef3d514ca5 100644 --- a/libafl/src/events/llmp/mgr.rs +++ b/libafl/src/events/llmp/mgr.rs @@ -410,7 +410,7 @@ where event: Event, ) -> Result<(), Error> where - E: Executor + HasObservers, + E: Executor::Input, S, Z> + HasObservers, E::Observers: ObserversTuple + Serialize, for<'a> E::Observers: Deserialize<'a>, Z: ExecutionProcessor::Input, E::Observers, S> @@ -608,7 +608,7 @@ where S: State + HasExecutions + HasMetadata + HasImported + HasCorpus, S::Corpus: Corpus, SP: ShMemProvider, - E: HasObservers + Executor, + E: HasObservers + Executor::Input, S, Z>, E::Observers: ObserversTuple + Serialize, for<'a> E::Observers: Deserialize<'a>, Z: ExecutionProcessor::Input, E::Observers, S> @@ -666,7 +666,7 @@ where impl EventManager for LlmpEventManager where - E: HasObservers + Executor, + E: HasObservers + Executor::Input, S, Z>, E::Observers: ObserversTuple + Serialize, for<'a> E::Observers: Deserialize<'a>, EMH: EventManagerHooksTuple, diff --git a/libafl/src/events/llmp/mod.rs b/libafl/src/events/llmp/mod.rs index 629ff6006a..147a41ae65 100644 --- a/libafl/src/events/llmp/mod.rs +++ b/libafl/src/events/llmp/mod.rs @@ -294,7 +294,7 @@ where event: Event, ) -> Result<(), Error> where - E: Executor + HasObservers, + E: Executor::Input, S, Z> + HasObservers, EM: UsesState + EventFirer, S::Corpus: Corpus, for<'a> E::Observers: Deserialize<'a>, @@ -349,7 +349,7 @@ where manager: &mut EM, ) -> Result where - E: Executor + HasObservers, + E: Executor::Input, S, Z> + HasObservers, EM: UsesState + EventFirer, S::Corpus: Corpus, for<'a> E::Observers: Deserialize<'a>, diff --git a/libafl/src/events/llmp/restarting.rs b/libafl/src/events/llmp/restarting.rs index 361e979ac1..1a0734ebd1 100644 --- a/libafl/src/events/llmp/restarting.rs +++ b/libafl/src/events/llmp/restarting.rs @@ -191,7 +191,7 @@ where impl EventProcessor for LlmpRestartingEventManager where - E: HasObservers + Executor, Z, State = S>, + E: HasObservers + Executor, ::Input, S, Z>, E::Observers: ObserversTuple + Serialize, for<'a> E::Observers: Deserialize<'a>, EMH: EventManagerHooksTuple, @@ -219,7 +219,7 @@ where impl EventManager for LlmpRestartingEventManager where - E: HasObservers + Executor, Z, State = S>, + E: HasObservers + Executor, ::Input, S, Z>, E::Observers: ObserversTuple + Serialize, for<'a> E::Observers: Deserialize<'a>, EMH: EventManagerHooksTuple, diff --git a/libafl/src/executors/command.rs b/libafl/src/executors/command.rs index ab19e8d98c..bb4a688dfd 100644 --- a/libafl/src/executors/command.rs +++ b/libafl/src/executors/command.rs @@ -745,7 +745,7 @@ impl CommandExecutorBuilder { /// # Example /// ``` /// use std::{io::Write, process::{Stdio, Command, Child}, time::Duration}; -/// use libafl::{Error, inputs::{BytesInput, HasTargetBytes, Input, UsesInput}, executors::{Executor, command::CommandConfigurator}, state::{UsesState, HasExecutions}}; +/// use libafl::{Error, corpus::Corpus, inputs::{BytesInput, HasTargetBytes, Input, UsesInput}, executors::{Executor, command::CommandConfigurator}, state::{HasCorpus, UsesState, HasExecutions}}; /// use libafl_bolts::AsSlice; /// #[derive(Debug)] /// struct MyExecutor; @@ -775,10 +775,12 @@ impl CommandExecutorBuilder { /// } /// } /// -/// fn make_executor() -> impl Executor +/// fn make_executor() -> impl Executor /// where /// EM: UsesState, /// EM::State: UsesInput + HasExecutions, +/// S: HasCorpus + HasExecutions, +/// S::Corpus: Corpus, /// { /// MyExecutor.into_executor(()) /// } @@ -865,7 +867,7 @@ mod tests { Executor, }, fuzzer::NopFuzzer, - inputs::BytesInput, + inputs::{BytesInput, NopInput}, monitors::SimpleMonitor, state::NopState, }; @@ -873,9 +875,10 @@ mod tests { #[test] #[cfg_attr(miri, ignore)] fn test_builder() { - let mut mgr = SimpleEventManager::new(SimpleMonitor::new(|status| { - log::info!("{status}"); - })); + let mut mgr: SimpleEventManager<_, NopState> = + SimpleEventManager::new(SimpleMonitor::new(|status| { + log::info!("{status}"); + })); let mut executor = CommandExecutor::builder(); executor diff --git a/libafl/src/executors/inprocess_fork/inner.rs b/libafl/src/executors/inprocess_fork/inner.rs index ad4b08b348..f6062c4ba0 100644 --- a/libafl/src/executors/inprocess_fork/inner.rs +++ b/libafl/src/executors/inprocess_fork/inner.rs @@ -20,7 +20,7 @@ use nix::{ #[cfg(all(unix, not(target_os = "linux")))] use crate::executors::hooks::timer::{setitimer, Itimerval, Timeval, ITIMER_REAL}; use crate::{ - events::{EventFirer, EventRestarter}, + corpus::Corpus, executors::{ hooks::{ inprocess_fork::{InChildProcessHooks, FORK_EXECUTOR_GLOBAL_DATA}, @@ -28,9 +28,8 @@ use crate::{ }, ExitKind, HasObservers, }, - inputs::UsesInput, observers::ObserversTuple, - state::{State, UsesState}, + state::HasCorpus, Error, }; @@ -73,13 +72,6 @@ where } } -impl UsesState for GenericInProcessForkExecutorInner -where - S: State, -{ - type State = S; -} - #[cfg(target_os = "linux")] fn parse_itimerspec(timeout: Duration) -> libc::itimerspec { let milli_sec = timeout.as_millis(); @@ -116,18 +108,17 @@ fn parse_itimerval(timeout: Duration) -> Itimerval { impl GenericInProcessForkExecutorInner where - OT: ObserversTuple + Debug, - S: State + UsesInput, + HT: ExecutorHooksTuple<::Input, S>, + S: HasCorpus, SP: ShMemProvider, - HT: ExecutorHooksTuple, - EM: EventFirer + EventRestarter, + OT: ObserversTuple<::Input, S>, { pub(super) unsafe fn pre_run_target_child( &mut self, fuzzer: &mut Z, - state: &mut as UsesState>::State, + state: &mut S, mgr: &mut EM, - input: & as UsesInput>::Input, + input: &::Input, ) -> Result<(), Error> { self.shmem_provider.post_fork(true)?; @@ -160,9 +151,9 @@ where pub(super) unsafe fn post_run_target_child( &mut self, fuzzer: &mut Z, - state: &mut as UsesState>::State, + state: &mut S, mgr: &mut EM, - input: & as UsesInput>::Input, + input: &::Input, ) { self.observers .post_exec_child_all(state, input, &ExitKind::Ok) @@ -209,18 +200,18 @@ where impl GenericInProcessForkExecutorInner where - HT: ExecutorHooksTuple, - S: State, - OT: ObserversTuple, + HT: ExecutorHooksTuple<::Input, S>, + OT: ObserversTuple<::Input, S>, + S: HasCorpus, { #[inline] /// This function marks the boundary between the fuzzer and the target. pub fn enter_target( &mut self, _fuzzer: &mut Z, - state: &mut ::State, + state: &mut S, _event_mgr: &mut EM, - input: &::Input, + input: &::Input, ) { unsafe { let data = &raw mut FORK_EXECUTOR_GLOBAL_DATA; @@ -245,9 +236,9 @@ where pub fn leave_target( &mut self, _fuzzer: &mut Z, - _state: &mut ::State, + _state: &mut S, _event_mgr: &mut EM, - _input: &::Input, + _input: &::Input, ) { // do nothing } @@ -303,10 +294,8 @@ where } } -impl HasObservers for GenericInProcessForkExecutorInner -where - OT: ObserversTuple, - S: State, +impl HasObservers + for GenericInProcessForkExecutorInner { type Observers = OT; diff --git a/libafl/src/executors/inprocess_fork/mod.rs b/libafl/src/executors/inprocess_fork/mod.rs index 5911adf334..56f21d1d64 100644 --- a/libafl/src/executors/inprocess_fork/mod.rs +++ b/libafl/src/executors/inprocess_fork/mod.rs @@ -14,16 +14,13 @@ use nix::unistd::{fork, ForkResult}; use super::hooks::ExecutorHooksTuple; use crate::{ - events::{EventFirer, EventRestarter}, + corpus::Corpus, executors::{ hooks::inprocess_fork::InProcessForkExecutorGlobalData, inprocess_fork::inner::GenericInProcessForkExecutorInner, Executor, ExitKind, HasObservers, }, - feedbacks::Feedback, - fuzzer::HasObjective, - inputs::UsesInput, observers::ObserversTuple, - state::{HasExecutions, HasSolutions, State, UsesState}, + state::{HasCorpus, HasExecutions}, Error, }; @@ -46,16 +43,10 @@ pub mod stateful; pub type InProcessForkExecutor<'a, H, OT, S, SP, EM, Z> = GenericInProcessForkExecutor<'a, H, (), OT, S, SP, EM, Z>; -impl<'a, H, OT, S, SP, EM, Z, OF> InProcessForkExecutor<'a, H, OT, S, SP, EM, Z> +impl<'a, H, OT, S, SP, EM, Z> InProcessForkExecutor<'a, H, OT, S, SP, EM, Z> where - H: FnMut(&S::Input) -> ExitKind + ?Sized, - S: State, - OT: ObserversTuple, - SP: ShMemProvider, - EM: EventFirer + EventRestarter, - OF: Feedback, - S: HasSolutions, - Z: HasObjective, + OT: ObserversTuple<::Input, S>, + S: HasCorpus, { /// The constructor for `InProcessForkExecutor` pub fn new( @@ -89,7 +80,12 @@ pub struct GenericInProcessForkExecutor<'a, H, HT, OT, S, SP, EM, Z> { inner: GenericInProcessForkExecutorInner, } -impl Debug for GenericInProcessForkExecutor<'_, H, HT, OT, S, SP, EM, Z> { +impl Debug for GenericInProcessForkExecutor<'_, H, HT, OT, S, SP, EM, Z> +where + HT: Debug, + OT: Debug, + SP: Debug, +{ #[cfg(target_os = "linux")] fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { f.debug_struct("GenericInProcessForkExecutor") @@ -110,20 +106,19 @@ impl Debug for GenericInProcessForkExecutor<'_, H, HT, impl Executor::Input, S, Z> for GenericInProcessForkExecutor<'_, H, HT, OT, S, SP, EM, Z> where - H: FnMut(&S::Input) -> ExitKind + ?Sized, - OT: ObserversTuple + Debug, - S: State + HasExecutions, + H: FnMut(&::Input) -> ExitKind + Sized, + S: HasCorpus + HasExecutions, SP: ShMemProvider, - HT: ExecutorHooksTuple, - EM: EventFirer + EventRestarter, + HT: ExecutorHooksTuple<::Input, S>, + OT: ObserversTuple<::Input, S>, { #[inline] fn run_target( &mut self, fuzzer: &mut Z, - state: &mut Self::State, + state: &mut S, mgr: &mut EM, - input: &Self::Input, + input: &::Input, ) -> Result { *state.executions_mut() += 1; @@ -147,16 +142,11 @@ where } } -impl<'a, H, HT, OT, S, SP, EM, Z, OF> GenericInProcessForkExecutor<'a, H, HT, OT, S, SP, EM, Z> +impl<'a, H, HT, OT, S, SP, EM, Z> GenericInProcessForkExecutor<'a, H, HT, OT, S, SP, EM, Z> where - H: FnMut(&S::Input) -> ExitKind + ?Sized, - HT: ExecutorHooksTuple, - OT: ObserversTuple, - SP: ShMemProvider, - EM: EventFirer + EventRestarter, - OF: Feedback, - S: State + HasSolutions, - Z: HasObjective, + HT: ExecutorHooksTuple<::Input, S>, + OT: ObserversTuple<::Input, S>, + S: HasCorpus, { /// Creates a new [`GenericInProcessForkExecutor`] with custom hooks #[expect(clippy::too_many_arguments)] @@ -200,13 +190,6 @@ where { impl HasObservers for GenericInProcessForkExecutor<'_, H, HT, OT, S, SP, EM, Z> -where - H: FnMut(&S::Input) -> ExitKind + ?Sized, - HT: ExecutorHooksTuple, - S: State, - OT: ObserversTuple, - SP: ShMemProvider, - EM: UsesState, { type Observers = OT; #[inline] @@ -233,7 +216,6 @@ pub mod child_signal_handlers { hooks::inprocess_fork::{InProcessForkExecutorGlobalData, FORK_EXECUTOR_GLOBAL_DATA}, ExitKind, HasObservers, }, - inputs::UsesInput, observers::ObserversTuple, }; @@ -400,7 +382,7 @@ mod tests { let input = NopInput {}; let mut fuzzer = NopFuzzer::new(); let mut state = NopState::new(); - let mut mgr = SimpleEventManager::printing(); + let mut mgr: SimpleEventManager<_, NopState> = SimpleEventManager::printing(); in_process_fork_executor .run_target(&mut fuzzer, &mut state, &mut mgr, &input) .unwrap(); diff --git a/libafl/src/executors/inprocess_fork/stateful.rs b/libafl/src/executors/inprocess_fork/stateful.rs index 82757511f7..547f5497b5 100644 --- a/libafl/src/executors/inprocess_fork/stateful.rs +++ b/libafl/src/executors/inprocess_fork/stateful.rs @@ -15,16 +15,13 @@ use libafl_bolts::{ use nix::unistd::{fork, ForkResult}; use crate::{ - events::{EventFirer, EventRestarter}, + corpus::Corpus, executors::{ hooks::ExecutorHooksTuple, inprocess_fork::GenericInProcessForkExecutorInner, Executor, ExitKind, HasObservers, }, - feedbacks::Feedback, - fuzzer::HasObjective, - inputs::UsesInput, observers::ObserversTuple, - state::{HasExecutions, State, UsesState}, + state::{HasCorpus, HasExecutions}, Error, }; @@ -34,9 +31,8 @@ pub type StatefulInProcessForkExecutor<'a, H, OT, S, SP, ES, EM, Z> = impl<'a, H, OT, S, SP, ES, EM, Z> StatefulInProcessForkExecutor<'a, H, OT, S, SP, ES, EM, Z> where - H: FnMut(&mut ES, &S::Input) -> ExitKind + ?Sized, - OT: ObserversTuple, - S: State, + OT: ObserversTuple<::Input, S>, + S: HasCorpus, { #[expect(clippy::too_many_arguments)] /// The constructor for `InProcessForkExecutor` @@ -65,11 +61,7 @@ where } /// [`StatefulGenericInProcessForkExecutor`] is an executor that forks the current process before each execution. Harness can access some internal state. -pub struct StatefulGenericInProcessForkExecutor<'a, H, HT, OT, S, SP, ES, EM, Z> -where - H: FnMut(&mut ES, &S::Input) -> ExitKind + ?Sized, - S: UsesInput, -{ +pub struct StatefulGenericInProcessForkExecutor<'a, H, HT, OT, S, SP, ES, EM, Z> { /// The harness function, being executed for each fuzzing loop execution harness_fn: &'a mut H, /// The state used as argument of the harness @@ -82,10 +74,8 @@ where impl Debug for StatefulGenericInProcessForkExecutor<'_, H, HT, OT, S, SP, ES, EM, Z> where - H: FnMut(&mut ES, &S::Input) -> ExitKind + ?Sized, HT: Debug, OT: Debug, - S: UsesInput, SP: Debug, { #[cfg(target_os = "linux")] @@ -105,34 +95,22 @@ where } } -impl UsesState +impl Executor::Input, S, Z> for StatefulGenericInProcessForkExecutor<'_, H, HT, OT, S, SP, ES, EM, Z> where - H: FnMut(&mut ES, &S::Input) -> ExitKind + ?Sized, - S: State, -{ - type State = S; -} - -impl Executor - for StatefulGenericInProcessForkExecutor<'_, H, HT, OT, S, SP, ES, EM, Z> -where - EM: EventFirer + EventRestarter, - H: FnMut(&mut ES, &S::Input) -> ExitKind + ?Sized, - HT: ExecutorHooksTuple, - OF: Feedback, - OT: ObserversTuple + Debug, - S: State + HasExecutions, + H: FnMut(&mut ES, &::Input) -> ExitKind + Sized, + HT: ExecutorHooksTuple<<::Corpus as Corpus>::Input, S>, + S: HasCorpus + HasExecutions, SP: ShMemProvider, - Z: HasObjective, + OT: ObserversTuple<<::Corpus as Corpus>::Input, S>, { #[inline] fn run_target( &mut self, fuzzer: &mut Z, - state: &mut Self::State, + state: &mut S, mgr: &mut EM, - input: &Self::Input, + input: &::Input, ) -> Result { *state.executions_mut() += 1; @@ -159,10 +137,9 @@ where impl<'a, H, HT, OT, S, SP, ES, EM, Z> StatefulGenericInProcessForkExecutor<'a, H, HT, OT, S, SP, ES, EM, Z> where - H: FnMut(&mut ES, &S::Input) -> ExitKind + ?Sized, - HT: ExecutorHooksTuple, - OT: ObserversTuple, - S: State, + HT: ExecutorHooksTuple<::Input, S>, + OT: ObserversTuple<::Input, S>, + S: HasCorpus, { /// Creates a new [`StatefulGenericInProcessForkExecutor`] with custom hooks #[expect(clippy::too_many_arguments)] @@ -208,10 +185,6 @@ where impl HasObservers for StatefulGenericInProcessForkExecutor<'_, H, HT, OT, S, SP, ES, EM, Z> -where - H: FnMut(&mut ES, &S::Input) -> ExitKind + ?Sized, - OT: ObserversTuple, - S: State, { type Observers = OT; diff --git a/libafl/src/executors/mod.rs b/libafl/src/executors/mod.rs index 5793e11b10..4a77191b93 100644 --- a/libafl/src/executors/mod.rs +++ b/libafl/src/executors/mod.rs @@ -221,24 +221,14 @@ mod test { let nonempty_input = BytesInput::new(vec![1u8]); let mut executor = NopExecutor::new(); let mut fuzzer = NopFuzzer::new(); - - let mut state = NopState::new(); + let mut mgr: NopEventManager> = NopEventManager::new(); + let mut state: NopState = NopState::new(); executor - .run_target( - &mut fuzzer, - &mut state, - &mut NopEventManager::new(), - &empty_input, - ) + .run_target(&mut fuzzer, &mut state, &mut mgr, &empty_input) .unwrap_err(); executor - .run_target( - &mut fuzzer, - &mut state, - &mut NopEventManager::new(), - &nonempty_input, - ) + .run_target(&mut fuzzer, &mut state, &mut mgr, &nonempty_input) .unwrap(); } } diff --git a/libafl/src/fuzzer/mod.rs b/libafl/src/fuzzer/mod.rs index 1b8e41daa6..f60086d229 100644 --- a/libafl/src/fuzzer/mod.rs +++ b/libafl/src/fuzzer/mod.rs @@ -513,7 +513,7 @@ impl EvaluatorObservers::I for StdFuzzer where CS: Scheduler<::Input, S>, - E: HasObservers + Executor, + E: HasObservers + Executor::Input, S, Self>, E::Observers: MatchName + ObserversTuple<::Input, S> + Serialize, EM: EventFirer, F: Feedback::Input, E::Observers, S>, @@ -591,7 +591,7 @@ impl Evaluator::Input, S> for StdFuzzer where CS: Scheduler<::Input, S>, - E: HasObservers + Executor, + E: HasObservers + Executor::Input, S, Self>, E::Observers: MatchName + ObserversTuple<::Input, S> + Serialize, EM: EventFirer, F: Feedback::Input, E::Observers, S>, @@ -748,7 +748,6 @@ where impl Fuzzer for StdFuzzer where CS: Scheduler, - E: UsesState, EM: ProgressReporter + EventProcessor, S: HasExecutions + HasMetadata @@ -923,7 +922,7 @@ impl ExecutesInput::Input, for StdFuzzer where CS: Scheduler<::Input, S>, - E: Executor + HasObservers, + E: Executor::Input, S, Self> + HasObservers, E::Observers: ObserversTuple<::Input, S>, EM: UsesState, S: UsesInput::Input> @@ -977,7 +976,6 @@ impl Default for NopFuzzer { impl Fuzzer for NopFuzzer where - E: UsesState, EM: ProgressReporter + EventProcessor, ST: StagesTuple, S: HasMetadata + HasExecutions + HasLastReportTime + HasCurrentStageId + UsesInput, diff --git a/libafl/src/stages/calibrate.rs b/libafl/src/stages/calibrate.rs index 50c07aeb09..dea94d6551 100644 --- a/libafl/src/stages/calibrate.rs +++ b/libafl/src/stages/calibrate.rs @@ -88,7 +88,7 @@ const CAL_STAGE_MAX: usize = 8; // AFL++'s CAL_CYCLES + 1 impl Stage for CalibrationStage where - E: Executor + HasObservers, + E: Executor::Input, S, Z> + HasObservers, EM: EventFirer, O: MapObserver, C: AsRef, diff --git a/libafl/src/stages/colorization.rs b/libafl/src/stages/colorization.rs index 5b97301439..a47b96f827 100644 --- a/libafl/src/stages/colorization.rs +++ b/libafl/src/stages/colorization.rs @@ -22,7 +22,7 @@ use crate::{ nonzero, observers::{MapObserver, ObserversTuple}, stages::{RetryCountRestartHelper, Stage}, - state::{HasCorpus, HasCurrentTestcase, HasRand, UsesState}, + state::{HasCorpus, HasCurrentTestcase, HasRand}, Error, HasMetadata, HasNamedMetadata, }; @@ -68,10 +68,7 @@ pub struct ColorizationStage { phantom: PhantomData<(E, EM, O, E, S, Z)>, } -impl Named for ColorizationStage -where - E: UsesState, -{ +impl Named for ColorizationStage { fn name(&self) -> &Cow<'static, str> { &self.name } @@ -80,7 +77,7 @@ where impl Stage for ColorizationStage where EM: EventFirer, - E: HasObservers + Executor, + E: HasObservers + Executor::Input, S, Z>, S: HasCorpus + HasMetadata + HasRand @@ -162,7 +159,7 @@ where EM: EventFirer, O: MapObserver, C: AsRef + Named, - E: HasObservers + Executor, + E: HasObservers + Executor::Input, S, Z>, E::Observers: ObserversTuple<::Input, S>, S: HasCorpus + HasMetadata diff --git a/libafl/src/stages/concolic.rs b/libafl/src/stages/concolic.rs index be5765f3c6..904bc524be 100644 --- a/libafl/src/stages/concolic.rs +++ b/libafl/src/stages/concolic.rs @@ -50,7 +50,7 @@ impl Named for ConcolicTracingStage<'_, EM, TE, S, Z> { impl Stage for ConcolicTracingStage<'_, EM, TE, S, Z> where - TE: Executor + HasObservers, + TE: Executor::Input, S, Z> + HasObservers, TE::Observers: ObserversTuple<::Input, S>, S: HasExecutions + HasCorpus diff --git a/libafl/src/stages/generalization.rs b/libafl/src/stages/generalization.rs index 00e1fbacf3..496a1bb49e 100644 --- a/libafl/src/stages/generalization.rs +++ b/libafl/src/stages/generalization.rs @@ -64,7 +64,7 @@ impl Stage for GeneralizationStage + Named, - E: Executor + HasObservers, + E: Executor + HasObservers, E::Observers: ObserversTuple, S: HasExecutions + HasMetadata @@ -348,6 +348,7 @@ where + HasCorpus + MaybeHasClientPerfMonitor + UsesInput, + S::Corpus: Corpus, OT: ObserversTuple, EM: UsesState, { @@ -375,7 +376,7 @@ where input: &BytesInput, ) -> Result where - E: Executor + HasObservers, + E: Executor::Input, S, Z> + HasObservers, E::Observers: ObserversTuple, { start_timer!(state); @@ -417,7 +418,7 @@ where split_char: u8, ) -> Result<(), Error> where - E: Executor + HasObservers, + E: Executor::Input, S, Z> + HasObservers, { let mut start = 0; while start < payload.len() { @@ -455,7 +456,7 @@ where closing_char: u8, ) -> Result<(), Error> where - E: Executor + HasObservers, + E: Executor::Input, S, Z> + HasObservers, { let mut index = 0; while index < payload.len() { diff --git a/libafl/src/stages/power.rs b/libafl/src/stages/power.rs index 695d2c6038..ba81b38b5e 100644 --- a/libafl/src/stages/power.rs +++ b/libafl/src/stages/power.rs @@ -79,7 +79,7 @@ where impl Stage for PowerMutationalStage where - E: Executor + HasObservers, + E: Executor::Input, S, Z> + HasObservers, EM: UsesState, F: TestcaseScore, M: Mutator, @@ -121,7 +121,7 @@ where impl PowerMutationalStage where - E: Executor + HasObservers, + E: Executor::Input, S, Z> + HasObservers, EM: UsesState, F: TestcaseScore, I: Input, diff --git a/libafl/src/stages/push/mod.rs b/libafl/src/stages/push/mod.rs index eba9d9797e..76a2389d94 100644 --- a/libafl/src/stages/push/mod.rs +++ b/libafl/src/stages/push/mod.rs @@ -256,7 +256,7 @@ where + HasNamedMetadata + HasMetadata + UsesInput::Input>, - E: Executor + HasObservers, + E: Executor::Input, S, Z> + HasObservers, EM: EventFirer + EventRestarter + HasEventManagerId + ProgressReporter, OT: ObserversTuple<::Input, S>, PS: PushStage::Input, OT, S, Z>, diff --git a/libafl/src/stages/sync.rs b/libafl/src/stages/sync.rs index 5d8ecd6c5b..57aee77461 100644 --- a/libafl/src/stages/sync.rs +++ b/libafl/src/stages/sync.rs @@ -243,7 +243,7 @@ where + UsesInput::Input> + State, SP: ShMemProvider, - E: HasObservers + Executor, + E: HasObservers + Executor::Input, S, Z>, for<'a> E::Observers: Deserialize<'a>, Z: EvaluatorObservers::Input, S> + ExecutionProcessor::Input, E::Observers, S>, diff --git a/libafl/src/stages/tracing.rs b/libafl/src/stages/tracing.rs index 3ca29cefbc..13dfdec1c0 100644 --- a/libafl/src/stages/tracing.rs +++ b/libafl/src/stages/tracing.rs @@ -32,7 +32,7 @@ pub struct TracingStage { impl TracingStage where - TE: Executor + HasObservers, + TE: Executor::Input, S, Z> + HasObservers, TE::Observers: ObserversTuple<::Input, S>, S: HasExecutions + HasCorpus @@ -76,7 +76,7 @@ where impl Stage for TracingStage where - TE: Executor + HasObservers, + TE: Executor::Input, S, Z> + HasObservers, TE::Observers: ObserversTuple<::Input, S>, S: HasExecutions + HasCorpus @@ -164,10 +164,10 @@ impl Named for ShadowTracingStage { } } -impl Stage, EM, S, Z> +impl Stage, EM, S, Z> for ShadowTracingStage where - E: Executor + HasObservers, + E: Executor::Input, S, Z> + HasObservers, E::Observers: ObserversTuple<::Input, S>, SOT: ObserversTuple<::Input, S>, S: HasExecutions @@ -184,7 +184,7 @@ where fn perform( &mut self, fuzzer: &mut Z, - executor: &mut ShadowExecutor, + executor: &mut ShadowExecutor, state: &mut S, manager: &mut EM, ) -> Result<(), Error> { @@ -227,13 +227,13 @@ where impl ShadowTracingStage where - E: Executor + HasObservers, + E: Executor::Input, S, Z> + HasObservers, S: HasExecutions + HasCorpus + UsesInput, SOT: ObserversTuple<::Input, S>, EM: UsesState, { /// Creates a new default stage - pub fn new(_executor: &mut ShadowExecutor) -> Self { + pub fn new(_executor: &mut ShadowExecutor) -> Self { // unsafe but impossible that you create two threads both instantiating this instance let stage_id = unsafe { let ret = SHADOW_TRACING_STAGE_ID; diff --git a/libafl/src/stages/verify_timeouts.rs b/libafl/src/stages/verify_timeouts.rs index 74e3e88c16..560f014340 100644 --- a/libafl/src/stages/verify_timeouts.rs +++ b/libafl/src/stages/verify_timeouts.rs @@ -84,7 +84,7 @@ impl TimeoutsToVerify { impl Stage for VerifyTimeoutsStage where E::Observers: ObserversTuple<::Input, S>, - E: Executor + HasObservers + HasTimeout, + E: Executor::Input, S, Z> + HasObservers + HasTimeout, EM: UsesState, Z: Evaluator::Input, S>, S: HasCorpus + HasMetadata + UsesInput::Input>, diff --git a/libafl_targets/src/cmps/stages/aflpptracing.rs b/libafl_targets/src/cmps/stages/aflpptracing.rs index 7d20d04e3f..308978c0f4 100644 --- a/libafl_targets/src/cmps/stages/aflpptracing.rs +++ b/libafl_targets/src/cmps/stages/aflpptracing.rs @@ -37,7 +37,7 @@ impl Named for AFLppCmplogTracingStage<'_, EM, TE, S, Z> { impl Stage for AFLppCmplogTracingStage<'_, EM, TE, S, Z> where EM: UsesState, - TE: HasObservers + Executor, + TE: HasObservers + Executor, TE::Observers: MatchNameRef + ObserversTuple, S: HasCorpus + HasCurrentTestcase