From 46716e80909ec88f1cfc78ae970ad7c24b15cd2d Mon Sep 17 00:00:00 2001 From: Andrea Fioraldi Date: Tue, 25 May 2021 15:19:10 +0200 Subject: [PATCH] Remove executor hooks (#124) * remove HasExecHooks from Executor * adapt the frida executor * adapt frida and avoid recursive type infearence * fix win build --- fuzzers/frida_libpng/src/fuzzer.rs | 53 ++++----------- libafl/src/events/llmp.rs | 10 +-- libafl/src/executors/combined.rs | 85 ++++++------------------ libafl/src/executors/forkserver.rs | 21 +++--- libafl/src/executors/inprocess.rs | 66 +++++++----------- libafl/src/executors/mod.rs | 43 ++++++------ libafl/src/executors/timeout.rs | 103 ++++++++++------------------- libafl/src/feedbacks/map.rs | 55 --------------- libafl/src/fuzzer.rs | 24 ++----- libafl/src/stages/tracing.rs | 32 +++------ 10 files changed, 143 insertions(+), 349 deletions(-) diff --git a/fuzzers/frida_libpng/src/fuzzer.rs b/fuzzers/frida_libpng/src/fuzzer.rs index 541a5c7e59..05e9afe9c1 100644 --- a/fuzzers/frida_libpng/src/fuzzer.rs +++ b/fuzzers/frida_libpng/src/fuzzer.rs @@ -20,7 +20,7 @@ use libafl::{ QueueCorpusScheduler, }, executors::{ - inprocess::InProcessExecutor, timeout::TimeoutExecutor, Executor, ExitKind, HasExecHooks, + inprocess::InProcessExecutor, timeout::TimeoutExecutor, Executor, ExitKind, HasExecHooksTuple, HasObservers, HasObserversHooks, }, feedback_or, @@ -65,7 +65,7 @@ where I: Input + HasTargetBytes, OT: ObserversTuple, { - base: TimeoutExecutor, I>, + base: TimeoutExecutor>, /// Frida's dynamic rewriting engine stalker: Stalker<'a>, /// User provided callback for instrumentation @@ -74,7 +74,7 @@ where _phantom: PhantomData<&'b u8>, } -impl<'a, 'b, 'c, FH, H, I, OT, S> Executor +impl<'a, 'b, 'c, EM, FH, H, I, OT, S, Z> Executor for FridaInProcessExecutor<'a, 'b, 'c, FH, H, I, OT, S> where FH: FridaHelper<'b>, @@ -84,7 +84,14 @@ where { /// Instruct the target about the input and run #[inline] - fn run_target(&mut self, input: &I) -> Result { + fn run_target( + &mut self, + fuzzer: &mut Z, + state: &mut S, + mgr: &mut EM, + input: &I, + ) -> Result { + self.helper.pre_exec(input); if self.helper.stalker_enabled() { if self.followed { self.stalker.activate(NativePointer( @@ -96,7 +103,7 @@ where .follow_me::(self.helper.transformer(), None); } } - let res = self.base.run_target(input); + let res = self.base.run_target(fuzzer, state, mgr, input); if self.helper.stalker_enabled() { self.stalker.deactivate(); } @@ -109,42 +116,8 @@ where if self.helper.stalker_enabled() { self.stalker.deactivate(); } - res - } -} - -impl<'a, 'b, 'c, EM, FH, H, I, OT, S, Z> HasExecHooks - for FridaInProcessExecutor<'a, 'b, 'c, FH, H, I, OT, S> -where - FH: FridaHelper<'b>, - H: FnMut(&I) -> ExitKind, - I: Input + HasTargetBytes, - OT: ObserversTuple, -{ - /// Called right before exexution starts - #[inline] - fn pre_exec( - &mut self, - fuzzer: &mut Z, - state: &mut S, - event_mgr: &mut EM, - input: &I, - ) -> Result<(), Error> { - self.helper.pre_exec(input); - self.base.pre_exec(fuzzer, state, event_mgr, input) - } - - /// Called right after execution finished. - #[inline] - fn post_exec( - &mut self, - fuzzer: &mut Z, - state: &mut S, - event_mgr: &mut EM, - input: &I, - ) -> Result<(), Error> { self.helper.post_exec(input); - self.base.post_exec(fuzzer, state, event_mgr, input) + res } } diff --git a/libafl/src/events/llmp.rs b/libafl/src/events/llmp.rs index 738b5de3d8..711f21e9f9 100644 --- a/libafl/src/events/llmp.rs +++ b/libafl/src/events/llmp.rs @@ -328,6 +328,7 @@ where event: Event, ) -> Result<(), Error> where + E: Executor, Z: IfInteresting + IsInteresting, { match event { @@ -346,6 +347,7 @@ where let observers: OT = postcard::from_bytes(&observers_buf)?; // TODO include ExitKind in NewTestcase + // TODO check for objective too let is_interesting = fuzzer.is_interesting(state, self, &input, &observers, &ExitKind::Ok)?; if fuzzer @@ -423,7 +425,7 @@ impl EventProcessor for LlmpEventManager, + E: Executor, I: Input, OT: ObserversTuple, Z: IfInteresting + IsInteresting, //CE: CustomEvent, @@ -469,7 +471,7 @@ impl EventManager for LlmpEventManager, + E: Executor, I: Input, OT: ObserversTuple, Z: IfInteresting + IsInteresting, //CE: CustomEvent, @@ -573,7 +575,7 @@ where impl EventProcessor for LlmpRestartingEventManager where - E: Executor, + E: Executor, I, S, Z>, I: Input, Z: IfInteresting + IsInteresting, OT: ObserversTuple, @@ -589,7 +591,7 @@ where impl EventManager for LlmpRestartingEventManager where - E: Executor, + E: Executor, I, S, Z>, I: Input, S: Serialize, Z: IfInteresting + IsInteresting, diff --git a/libafl/src/executors/combined.rs b/libafl/src/executors/combined.rs index 208a349e53..a4ae7b3ccb 100644 --- a/libafl/src/executors/combined.rs +++ b/libafl/src/executors/combined.rs @@ -1,41 +1,22 @@ //! A `CombinedExecutor` wraps a primary executor and a secondary one -use core::marker::PhantomData; - use crate::{ - executors::{ - Executor, ExitKind, HasExecHooks, HasExecHooksTuple, HasObservers, HasObserversHooks, - }, + executors::{Executor, ExitKind, HasExecHooksTuple, HasObservers, HasObserversHooks}, inputs::Input, observers::ObserversTuple, Error, }; /// A [`CombinedExecutor`] wraps a primary executor, forwarding its methods, and a secondary one -pub struct CombinedExecutor -where - A: Executor, - B: Executor, - I: Input, -{ +pub struct CombinedExecutor { primary: A, secondary: B, - phantom: PhantomData, } -impl CombinedExecutor -where - A: Executor, - B: Executor, - I: Input, -{ +impl CombinedExecutor { /// Create a new `CombinedExecutor`, wrapping the given `executor`s. - pub fn new(primary: A, secondary: B) -> Self { - Self { - primary, - secondary, - phantom: PhantomData, - } + pub fn new(primary: A, secondary: B) -> Self { + Self { primary, secondary } } /// Retrieve the primary `Executor` that is wrapped by this `CombinedExecutor`. @@ -49,22 +30,26 @@ where } } -impl Executor for CombinedExecutor +impl Executor for CombinedExecutor where - A: Executor, - B: Executor, + A: Executor, + B: Executor, I: Input, { - fn run_target(&mut self, input: &I) -> Result { - self.primary.run_target(input) + fn run_target( + &mut self, + fuzzer: &mut Z, + state: &mut S, + mgr: &mut EM, + input: &I, + ) -> Result { + self.primary.run_target(fuzzer, state, mgr, input) } } -impl HasObservers for CombinedExecutor +impl HasObservers for CombinedExecutor where - A: Executor + HasObservers, - B: Executor, - I: Input, + A: HasObservers, OT: ObserversTuple, { #[inline] @@ -78,40 +63,10 @@ where } } -impl HasObserversHooks for CombinedExecutor +impl HasObserversHooks for CombinedExecutor where - A: Executor + HasObservers, - B: Executor, + A: HasObservers, I: Input, OT: ObserversTuple + HasExecHooksTuple, { } - -impl HasExecHooks for CombinedExecutor -where - A: Executor + HasExecHooks, - B: Executor, - I: Input, -{ - #[inline] - fn pre_exec( - &mut self, - fuzzer: &mut Z, - state: &mut S, - mgr: &mut EM, - input: &I, - ) -> Result<(), Error> { - self.primary.pre_exec(fuzzer, state, mgr, input) - } - - #[inline] - fn post_exec( - &mut self, - fuzzer: &mut Z, - state: &mut S, - mgr: &mut EM, - input: &I, - ) -> Result<(), Error> { - self.primary.post_exec(fuzzer, state, mgr, input) - } -} diff --git a/libafl/src/executors/forkserver.rs b/libafl/src/executors/forkserver.rs index 7bfa0bfa0c..b6f8bc0011 100644 --- a/libafl/src/executors/forkserver.rs +++ b/libafl/src/executors/forkserver.rs @@ -13,9 +13,7 @@ use std::{ use crate::bolts::os::{dup2, pipes::Pipe}; use crate::{ - executors::{ - Executor, ExitKind, HasExecHooks, HasExecHooksTuple, HasObservers, HasObserversHooks, - }, + executors::{Executor, ExitKind, HasExecHooksTuple, HasObservers, HasObserversHooks}, inputs::{HasTargetBytes, Input}, observers::ObserversTuple, Error, @@ -328,13 +326,19 @@ where } } -impl Executor for ForkserverExecutor +impl Executor for ForkserverExecutor where I: Input + HasTargetBytes, OT: ObserversTuple, { #[inline] - fn run_target(&mut self, input: &I) -> Result { + fn run_target( + &mut self, + _fuzzer: &mut Z, + _state: &mut S, + _mgr: &mut EM, + input: &I, + ) -> Result { let mut exit_kind = ExitKind::Ok; // Write to testcase @@ -377,13 +381,6 @@ where } } -impl HasExecHooks for ForkserverExecutor -where - I: Input + HasTargetBytes, - OT: ObserversTuple, -{ -} - impl HasObservers for ForkserverExecutor where I: Input + HasTargetBytes, diff --git a/libafl/src/executors/inprocess.rs b/libafl/src/executors/inprocess.rs index a6058e2f96..e17324318d 100644 --- a/libafl/src/executors/inprocess.rs +++ b/libafl/src/executors/inprocess.rs @@ -18,9 +18,7 @@ use crate::bolts::os::windows_exceptions::setup_exception_handler; use crate::{ corpus::Corpus, events::{EventFirer, EventRestarter}, - executors::{ - Executor, ExitKind, HasExecHooks, HasExecHooksTuple, HasObservers, HasObserversHooks, - }, + executors::{Executor, ExitKind, HasExecHooksTuple, HasObservers, HasObserversHooks}, feedbacks::Feedback, fuzzer::HasObjective, inputs::Input, @@ -43,39 +41,26 @@ where phantom: PhantomData<(I, S)>, } -impl<'a, H, I, OT, S> Executor for InProcessExecutor<'a, H, I, OT, S> +impl<'a, EM, H, I, OT, S, Z> Executor for InProcessExecutor<'a, H, I, OT, S> where H: FnMut(&I) -> ExitKind, I: Input, OT: ObserversTuple, { #[inline] - fn run_target(&mut self, input: &I) -> Result { - let ret = (self.harness_fn)(input); - Ok(ret) - } -} - -impl<'a, EM, H, I, OT, S, Z> HasExecHooks for InProcessExecutor<'a, H, I, OT, S> -where - H: FnMut(&I) -> ExitKind, - I: Input, - OT: ObserversTuple, -{ - #[inline] - fn pre_exec( + fn run_target( &mut self, - _fuzzer: &mut Z, - _state: &mut S, - _event_mgr: &mut EM, - _input: &I, - ) -> Result<(), Error> { + fuzzer: &mut Z, + state: &mut S, + mgr: &mut EM, + input: &I, + ) -> Result { #[cfg(unix)] unsafe { let data = &mut unix_signal_handler::GLOBAL_STATE; write_volatile( &mut data.current_input_ptr, - _input as *const _ as *const c_void, + input as *const _ as *const c_void, ); write_volatile( &mut data.observers_ptr, @@ -83,9 +68,9 @@ where ); // Direct raw pointers access /aliasing is pretty undefined behavior. // Since the state and event may have moved in memory, refresh them right before the signal may happen - write_volatile(&mut data.state_ptr, _state as *mut _ as *mut c_void); - write_volatile(&mut data.event_mgr_ptr, _event_mgr as *mut _ as *mut c_void); - write_volatile(&mut data.fuzzer_ptr, _fuzzer as *mut _ as *mut c_void); + write_volatile(&mut data.state_ptr, state as *mut _ as *mut c_void); + write_volatile(&mut data.event_mgr_ptr, mgr as *mut _ as *mut c_void); + write_volatile(&mut data.fuzzer_ptr, fuzzer as *mut _ as *mut c_void); compiler_fence(Ordering::SeqCst); } #[cfg(all(windows, feature = "std"))] @@ -93,7 +78,7 @@ where let data = &mut windows_exception_handler::GLOBAL_STATE; write_volatile( &mut data.current_input_ptr, - _input as *const _ as *const c_void, + input as *const _ as *const c_void, ); write_volatile( &mut data.observers_ptr, @@ -101,22 +86,14 @@ where ); // Direct raw pointers access /aliasing is pretty undefined behavior. // Since the state and event may have moved in memory, refresh them right before the signal may happen - write_volatile(&mut data.state_ptr, _state as *mut _ as *mut c_void); - write_volatile(&mut data.event_mgr_ptr, _event_mgr as *mut _ as *mut c_void); - write_volatile(&mut data.fuzzer_ptr, _fuzzer as *mut _ as *mut c_void); + write_volatile(&mut data.state_ptr, state as *mut _ as *mut c_void); + write_volatile(&mut data.event_mgr_ptr, mgr as *mut _ as *mut c_void); + write_volatile(&mut data.fuzzer_ptr, fuzzer as *mut _ as *mut c_void); compiler_fence(Ordering::SeqCst); } - Ok(()) - } - #[inline] - fn post_exec( - &mut self, - _fuzzer: &mut Z, - _state: &mut S, - _event_mgr: &mut EM, - _input: &I, - ) -> Result<(), Error> { + let ret = (self.harness_fn)(input); + #[cfg(unix)] unsafe { write_volatile( @@ -133,7 +110,8 @@ where ); compiler_fence(Ordering::SeqCst); } - Ok(()) + + Ok(ret) } } @@ -742,6 +720,8 @@ mod tests { phantom: PhantomData, }; let input = NopInput {}; - assert!(in_process_executor.run_target(&input).is_ok()); + assert!(in_process_executor + .run_target(&mut (), &mut (), &mut (), &input) + .is_ok()); } } diff --git a/libafl/src/executors/mod.rs b/libafl/src/executors/mod.rs index 3a7a4b3864..1d62dab5b9 100644 --- a/libafl/src/executors/mod.rs +++ b/libafl/src/executors/mod.rs @@ -13,8 +13,6 @@ pub use forkserver::{Forkserver, ForkserverExecutor, OutFile}; pub mod combined; pub use combined::CombinedExecutor; -use core::marker::PhantomData; - use crate::{ bolts::serdeany::SerdeAny, inputs::{HasTargetBytes, Input}, @@ -184,25 +182,35 @@ where } /// An executor takes the given inputs, and runs the harness/target. -pub trait Executor +pub trait Executor where I: Input, { /// Instruct the target about the input and run - fn run_target(&mut self, input: &I) -> Result; + fn run_target( + &mut self, + fuzzer: &mut Z, + state: &mut S, + mgr: &mut EM, + input: &I, + ) -> Result; } /// A simple executor that does nothing. /// If intput len is 0, `run_target` will return Err -struct NopExecutor { - phantom: PhantomData<(EM, I, S)>, -} +struct NopExecutor {} -impl Executor for NopExecutor +impl Executor for NopExecutor where I: Input + HasTargetBytes, { - fn run_target(&mut self, input: &I) -> Result { + fn run_target( + &mut self, + _fuzzer: &mut Z, + _state: &mut S, + _mgr: &mut EM, + input: &I, + ) -> Result { if input.target_bytes().as_slice().is_empty() { Err(Error::Empty("Input Empty".into())) } else { @@ -211,13 +219,8 @@ where } } -impl HasExecHooks for NopExecutor where I: Input + HasTargetBytes -{} - #[cfg(test)] mod test { - use core::marker::PhantomData; - use super::{Executor, NopExecutor}; use crate::inputs::BytesInput; @@ -225,10 +228,12 @@ mod test { fn nop_executor() { let empty_input = BytesInput::new(vec![]); let nonempty_input = BytesInput::new(vec![1u8]); - let mut executor = NopExecutor::<(), _, ()> { - phantom: PhantomData, - }; - assert!(executor.run_target(&empty_input).is_err()); - assert!(executor.run_target(&nonempty_input).is_ok()); + let mut executor = NopExecutor {}; + assert!(executor + .run_target(&mut (), &mut (), &mut (), &empty_input) + .is_err()); + assert!(executor + .run_target(&mut (), &mut (), &mut (), &nonempty_input) + .is_ok()); } } diff --git a/libafl/src/executors/timeout.rs b/libafl/src/executors/timeout.rs index 7a89dc9a2c..9ec41f5a0b 100644 --- a/libafl/src/executors/timeout.rs +++ b/libafl/src/executors/timeout.rs @@ -1,11 +1,9 @@ //! A `TimeoutExecutor` sets a timeout before each target run -use core::{marker::PhantomData, time::Duration}; +use core::time::Duration; use crate::{ - executors::{ - Executor, ExitKind, HasExecHooks, HasExecHooksTuple, HasObservers, HasObserversHooks, - }, + executors::{Executor, ExitKind, HasExecHooksTuple, HasObservers, HasObserversHooks}, inputs::Input, observers::ObserversTuple, Error, @@ -39,28 +37,18 @@ extern "C" { const ITIMER_REAL: c_int = 0; /// The timeout excutor is a wrapper that set a timeout before each run -pub struct TimeoutExecutor -where - E: Executor, - I: Input, -{ +pub struct TimeoutExecutor { executor: E, exec_tmout: Duration, - phantom: PhantomData, } -impl TimeoutExecutor -where - E: Executor, - I: Input, -{ +impl TimeoutExecutor { /// Create a new `TimeoutExecutor`, wrapping the given `executor` and checking for timeouts. /// This should usually be used for `InProcess` fuzzing. pub fn new(executor: E, exec_tmout: Duration) -> Self { Self { executor, exec_tmout, - phantom: PhantomData, } } @@ -70,54 +58,18 @@ where } } -impl Executor for TimeoutExecutor +impl Executor for TimeoutExecutor where - E: Executor, + E: Executor, I: Input, { - fn run_target(&mut self, input: &I) -> Result { - self.executor.run_target(input) - } -} - -impl HasObservers for TimeoutExecutor -where - E: Executor + HasObservers, - I: Input, - OT: ObserversTuple, -{ - #[inline] - fn observers(&self) -> &OT { - self.executor.observers() - } - - #[inline] - fn observers_mut(&mut self) -> &mut OT { - self.executor.observers_mut() - } -} - -impl HasObserversHooks for TimeoutExecutor -where - E: Executor + HasObservers, - I: Input, - OT: ObserversTuple + HasExecHooksTuple, -{ -} - -impl HasExecHooks for TimeoutExecutor -where - E: Executor + HasExecHooks, - I: Input, -{ - #[inline] - fn pre_exec( + fn run_target( &mut self, fuzzer: &mut Z, state: &mut S, mgr: &mut EM, input: &I, - ) -> Result<(), Error> { + ) -> Result { #[cfg(unix)] unsafe { let milli_sec = self.exec_tmout.as_millis(); @@ -143,17 +95,9 @@ where // TODO let _ = self.exec_tmout.as_millis(); } - self.executor.pre_exec(fuzzer, state, mgr, input) - } - #[inline] - fn post_exec( - &mut self, - fuzzer: &mut Z, - state: &mut S, - mgr: &mut EM, - input: &I, - ) -> Result<(), Error> { + let ret = self.executor.run_target(fuzzer, state, mgr, input); + #[cfg(unix)] unsafe { let it_value = Timeval { @@ -177,6 +121,31 @@ where { // TODO } - self.executor.post_exec(fuzzer, state, mgr, input) + + ret } } + +impl HasObservers for TimeoutExecutor +where + E: HasObservers, + OT: ObserversTuple, +{ + #[inline] + fn observers(&self) -> &OT { + self.executor.observers() + } + + #[inline] + fn observers_mut(&mut self) -> &mut OT { + self.executor.observers_mut() + } +} + +impl HasObserversHooks for TimeoutExecutor +where + E: HasObservers, + I: Input, + OT: ObserversTuple + HasExecHooksTuple, +{ +} diff --git a/libafl/src/feedbacks/map.rs b/libafl/src/feedbacks/map.rs index 400b808501..0bea825c66 100644 --- a/libafl/src/feedbacks/map.rs +++ b/libafl/src/feedbacks/map.rs @@ -265,61 +265,6 @@ where } } - /*if self.indexes.is_none() && self.novelties.is_none() { - for i in 0..size { - let history = map_state.history_map[i]; - let item = observer.map()[i]; - - let reduced = R::reduce(history, item); - if history != reduced { - map_state.history_map[i] = reduced; - interesting = true; - } - } - } else if self.indexes.is_some() && self.novelties.is_none() { - for i in 0..size { - let history = map_state.history_map[i]; - let item = observer.map()[i]; - // TODO maybe walk again the histroy map only when it is interesting is more efficient - if item != initial { - self.indexes.as_mut().unwrap().push(i); - } - - let reduced = R::reduce(history, item); - if history != reduced { - map_state.history_map[i] = reduced; - interesting = true; - } - } - } else if self.indexes.is_none() && self.novelties.is_some() { - for i in 0..size { - let history = map_state.history_map[i]; - let item = observer.map()[i]; - - let reduced = R::reduce(history, item); - if history != reduced { - map_state.history_map[i] = reduced; - interesting = true; - self.novelties.as_mut().unwrap().push(i); - } - } - } else { - for i in 0..size { - let history = map_state.history_map[i]; - let item = observer.map()[i]; - if item != initial { - self.indexes.as_mut().unwrap().push(i); - } - - let reduced = R::reduce(history, item); - if history != reduced { - map_state.history_map[i] = reduced; - interesting = true; - self.novelties.as_mut().unwrap().push(i); - } - } - }*/ - if interesting { let mut filled = 0; for i in 0..size { diff --git a/libafl/src/fuzzer.rs b/libafl/src/fuzzer.rs index 44a19f6594..ecede5cee0 100644 --- a/libafl/src/fuzzer.rs +++ b/libafl/src/fuzzer.rs @@ -4,9 +4,7 @@ use crate::{ bolts::current_time, corpus::{Corpus, CorpusScheduler, Testcase}, events::{Event, EventFirer, EventManager}, - executors::{ - Executor, ExitKind, HasExecHooks, HasExecHooksTuple, HasObservers, HasObserversHooks, - }, + executors::{Executor, ExitKind, HasExecHooksTuple, HasObservers, HasObserversHooks}, feedbacks::Feedback, inputs::Input, mark_feature_time, @@ -321,10 +319,7 @@ impl Evaluator where C: Corpus, CS: CorpusScheduler, - E: Executor - + HasObservers - + HasExecHooks - + HasObserversHooks, + E: Executor + HasObservers + HasObserversHooks, OT: ObserversTuple + HasExecHooksTuple, EM: EventManager, F: Feedback, @@ -521,10 +516,7 @@ where input: &I, ) -> Result where - E: Executor - + HasObservers - + HasExecHooks - + HasObserversHooks, + E: Executor + HasObservers + HasObserversHooks, OT: ObserversTuple + HasExecHooksTuple, EM: EventManager, { @@ -533,17 +525,9 @@ where mark_feature_time!(state, PerfFeature::PreExecObservers); start_timer!(state); - executor.pre_exec(self, state, event_mgr, input)?; - mark_feature_time!(state, PerfFeature::PreExec); - - start_timer!(state); - let exit_kind = executor.run_target(input)?; + let exit_kind = executor.run_target(self, state, event_mgr, input)?; mark_feature_time!(state, PerfFeature::TargetExecution); - start_timer!(state); - executor.post_exec(self, state, event_mgr, input)?; - mark_feature_time!(state, PerfFeature::PostExec); - *state.executions_mut() += 1; start_timer!(state); diff --git a/libafl/src/stages/tracing.rs b/libafl/src/stages/tracing.rs index 3e88771a2a..4e37dce554 100644 --- a/libafl/src/stages/tracing.rs +++ b/libafl/src/stages/tracing.rs @@ -2,7 +2,7 @@ use core::{marker::PhantomData, mem::drop}; use crate::{ corpus::Corpus, - executors::{Executor, HasExecHooks, HasExecHooksTuple, HasObservers, HasObserversHooks}, + executors::{Executor, HasExecHooksTuple, HasObservers, HasObserversHooks}, inputs::Input, mark_feature_time, observers::ObserversTuple, @@ -21,10 +21,7 @@ pub struct TracingStage where I: Input, C: Corpus, - TE: Executor - + HasObservers - + HasExecHooks - + HasObserversHooks, + TE: Executor + HasObservers + HasObserversHooks, OT: ObserversTuple + HasExecHooksTuple, S: HasClientPerfStats + HasExecutions + HasCorpus, { @@ -37,10 +34,7 @@ impl Stage for TracingStage, - TE: Executor - + HasObservers - + HasExecHooks - + HasObserversHooks, + TE: Executor + HasObservers + HasObserversHooks, OT: ObserversTuple + HasExecHooksTuple, S: HasClientPerfStats + HasExecutions + HasCorpus, { @@ -68,19 +62,12 @@ where mark_feature_time!(state, PerfFeature::PreExecObservers); start_timer!(state); - self.tracer_executor - .pre_exec(fuzzer, state, manager, &input)?; - mark_feature_time!(state, PerfFeature::PreExec); - - start_timer!(state); - drop(self.tracer_executor.run_target(&input)?); + drop( + self.tracer_executor + .run_target(fuzzer, state, manager, &input)?, + ); mark_feature_time!(state, PerfFeature::TargetExecution); - start_timer!(state); - self.tracer_executor - .post_exec(fuzzer, state, manager, &input)?; - mark_feature_time!(state, PerfFeature::PostExec); - *state.executions_mut() += 1; start_timer!(state); @@ -96,10 +83,7 @@ impl TracingStage where I: Input, C: Corpus, - TE: Executor - + HasObservers - + HasExecHooks - + HasObserversHooks, + TE: Executor + HasObservers + HasObserversHooks, OT: ObserversTuple + HasExecHooksTuple, S: HasClientPerfStats + HasExecutions + HasCorpus, {