From 0a4a40101aa4b5508f135e08abe7b3836f73310c Mon Sep 17 00:00:00 2001 From: Andrea Fioraldi Date: Fri, 5 Mar 2021 14:19:17 +0100 Subject: [PATCH] fix executor post exec --- libafl/src/executors/mod.rs | 39 +++---------------------------------- libafl/src/state/mod.rs | 2 +- 2 files changed, 4 insertions(+), 37 deletions(-) diff --git a/libafl/src/executors/mod.rs b/libafl/src/executors/mod.rs index 82f01de97c..4df5c3ed71 100644 --- a/libafl/src/executors/mod.rs +++ b/libafl/src/executors/mod.rs @@ -9,7 +9,7 @@ use core::cmp::PartialEq; use core::marker::PhantomData; use crate::{ - bolts::tuples::{MatchNameAndType, MatchType, Named, TupleList}, + bolts::tuples::{Named}, events::EventManager, inputs::{HasTargetBytes, Input}, observers::ObserversTuple, @@ -78,8 +78,8 @@ pub trait Executor: Named where I: Input, { - #[inline] /// Called right before exexution starts + #[inline] fn pre_exec( &mut self, _state: &mut S, @@ -92,8 +92,8 @@ where Ok(()) } - #[inline] /// Called right after execution finished. + #[inline] fn post_exec(&mut self, _state: &S, _event_mgr: &mut EM, _input: &I) -> Result<(), Error> where EM: EventManager, @@ -105,39 +105,6 @@ where fn run_target(&mut self, input: &I) -> Result; } -pub trait ExecutorsTuple: MatchType + MatchNameAndType -where - I: Input, -{ - //fn for_each(&self, f: fn(&dyn Executor)); - //fn for_each_mut(&mut self, f: fn(&mut dyn Executor)); -} - -impl ExecutorsTuple for () -where - I: Input, -{ - //fn for_each(&self, _f: fn(&dyn Executor)) {} - //fn for_each_mut(&mut self, _f: fn(&mut dyn Executor)) {} -} - -impl ExecutorsTuple for (Head, Tail) -where - Head: Executor + 'static, - Tail: ExecutorsTuple + TupleList, - I: Input, -{ - /*fn for_each(&self, f: fn(&dyn Executor)) { - f(&self.0); - self.1.for_each(f) - } - - fn for_each_mut(&mut self, f: fn(&mut dyn Executor)) { - f(&mut self.0); - self.1.for_each_mut(f) - }*/ -} - #[cfg(test)] mod test { use core::marker::PhantomData; diff --git a/libafl/src/state/mod.rs b/libafl/src/state/mod.rs index d201143ad7..5f4cf154f5 100644 --- a/libafl/src/state/mod.rs +++ b/libafl/src/state/mod.rs @@ -647,7 +647,7 @@ where executor.pre_exec(self, event_mgr, input)?; let exit_kind = executor.run_target(input)?; - //executor.post_exec(&self, event_mgr, input)?; + executor.post_exec(self, event_mgr, input)?; *self.executions_mut() += 1; executor.post_exec_observers()?;