diff --git a/libafl/src/events/hooks/mod.rs b/libafl/src/events/hooks/mod.rs index 48360a3ae7..b10c0c8f0e 100644 --- a/libafl/src/events/hooks/mod.rs +++ b/libafl/src/events/hooks/mod.rs @@ -12,23 +12,15 @@ where { /// The hook that runs before `handle_in_client` /// Return false if you want to cancel the subsequent event handling - fn pre_exec( + fn pre_exec( &mut self, - fuzzer: &mut Z, - executor: &mut E, state: &mut S, client_id: ClientId, event: &Event, ) -> Result; /// The hook that runs after `handle_in_client` /// Return false if you want to cancel the subsequent event handling - fn post_exec( - &mut self, - fuzzer: &mut Z, - executor: &mut E, - state: &mut S, - client_id: ClientId, - ) -> Result; + fn post_exec(&mut self, state: &mut S, client_id: ClientId) -> Result; } /// The tuples contains hooks to be executed for `handle_in_client` @@ -37,22 +29,14 @@ where S: State, { /// The hook that runs before `handle_in_client` - fn pre_exec_all( + fn pre_exec_all( &mut self, - fuzzer: &mut Z, - executor: &mut E, state: &mut S, client_id: ClientId, event: &Event, ) -> Result; /// The hook that runs after `handle_in_client` - fn post_exec_all( - &mut self, - fuzzer: &mut Z, - executor: &mut E, - state: &mut S, - client_id: ClientId, - ) -> Result; + fn post_exec_all(&mut self, state: &mut S, client_id: ClientId) -> Result; } impl EventManagerHooksTuple for () @@ -60,10 +44,8 @@ where S: State, { /// The hook that runs before `handle_in_client` - fn pre_exec_all( + fn pre_exec_all( &mut self, - _fuzzer: &mut Z, - _executor: &mut E, _state: &mut S, _client_id: ClientId, _event: &Event, @@ -71,13 +53,7 @@ where Ok(true) } /// The hook that runs after `handle_in_client` - fn post_exec_all( - &mut self, - _fuzzer: &mut Z, - _executor: &mut E, - _state: &mut S, - _client_id: ClientId, - ) -> Result { + fn post_exec_all(&mut self, _state: &mut S, _client_id: ClientId) -> Result { Ok(true) } } @@ -89,30 +65,20 @@ where S: State, { /// The hook that runs before `handle_in_client` - fn pre_exec_all( + fn pre_exec_all( &mut self, - fuzzer: &mut Z, - executor: &mut E, state: &mut S, client_id: ClientId, event: &Event, ) -> Result { - let first = self.0.pre_exec(fuzzer, executor, state, client_id, event)?; - let second = self - .1 - .pre_exec_all(fuzzer, executor, state, client_id, event)?; + let first = self.0.pre_exec(state, client_id, event)?; + let second = self.1.pre_exec_all(state, client_id, event)?; Ok(first & second) } /// The hook that runs after `handle_in_client` - fn post_exec_all( - &mut self, - fuzzer: &mut Z, - executor: &mut E, - state: &mut S, - client_id: ClientId, - ) -> Result { - let first = self.0.post_exec(fuzzer, executor, state, client_id)?; - let second = self.1.post_exec_all(fuzzer, executor, state, client_id)?; + fn post_exec_all(&mut self, state: &mut S, client_id: ClientId) -> Result { + let first = self.0.post_exec(state, client_id)?; + let second = self.1.post_exec_all(state, client_id)?; Ok(first & second) } } diff --git a/libafl/src/events/llmp.rs b/libafl/src/events/llmp.rs index b3f67757e5..53db7d30ae 100644 --- a/libafl/src/events/llmp.rs +++ b/libafl/src/events/llmp.rs @@ -610,10 +610,7 @@ where for<'a> E::Observers: Deserialize<'a>, Z: ExecutionProcessor + EvaluatorObservers, { - if self - .hooks - .pre_exec_all(fuzzer, executor, state, client_id, &event)? - { + if self.hooks.pre_exec_all(state, client_id, &event)? { return Ok(()); } match event { @@ -672,8 +669,7 @@ where ))); } } - self.hooks - .post_exec_all(fuzzer, executor, state, client_id)?; + self.hooks.post_exec_all(state, client_id)?; Ok(()) } } diff --git a/libafl/src/events/tcp.rs b/libafl/src/events/tcp.rs index 95efd7c0ec..9fe7976ee8 100644 --- a/libafl/src/events/tcp.rs +++ b/libafl/src/events/tcp.rs @@ -621,10 +621,7 @@ where for<'a> E::Observers: Deserialize<'a>, Z: ExecutionProcessor + EvaluatorObservers, { - if !self - .hooks - .pre_exec_all(fuzzer, executor, state, client_id, &event)? - { + if !self.hooks.pre_exec_all(state, client_id, &event)? { return Ok(()); } match event { @@ -677,8 +674,7 @@ where ))) } } - self.hooks - .post_exec_all(fuzzer, executor, state, client_id)?; + self.hooks.post_exec_all(state, client_id)?; Ok(()) } }