From 8e512a68b5a19da76f04149a5b22c6f7a69d054e Mon Sep 17 00:00:00 2001 From: Dominik Maier Date: Fri, 5 Feb 2021 01:15:03 +0100 Subject: [PATCH] more generic reordering --- afl/src/executors/inmemory.rs | 20 ++++++++++---------- afl/src/lib.rs | 8 ++++---- afl/src/stages/mod.rs | 8 ++++---- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/afl/src/executors/inmemory.rs b/afl/src/executors/inmemory.rs index a53f37b7ed..5df99777b3 100644 --- a/afl/src/executors/inmemory.rs +++ b/afl/src/executors/inmemory.rs @@ -63,7 +63,7 @@ where #[cfg(unix)] #[cfg(feature = "std")] unsafe { - set_oncrash_ptrs::(_state, _event_mgr, _input); + set_oncrash_ptrs::(_state, _event_mgr, _input); } Ok(()) } @@ -84,7 +84,7 @@ where #[cfg(unix)] #[cfg(feature = "std")] unsafe { - reset_oncrash_ptrs::(); + reset_oncrash_ptrs::(); } Ok(()) } @@ -151,7 +151,7 @@ where { #[cfg(feature = "std")] unsafe { - setup_crash_handlers::(); + setup_crash_handlers::(); } Self { @@ -214,7 +214,7 @@ pub mod unix_signals { /// This is neede for certain non-rust side effects, as well as unix signal handling. static mut CURRENT_INPUT_PTR: *const c_void = ptr::null(); - pub unsafe extern "C" fn libaflrs_executor_inmem_handle_crash( + pub unsafe extern "C" fn libaflrs_executor_inmem_handle_crash( _sig: c_int, info: siginfo_t, _void: c_void, @@ -257,7 +257,7 @@ pub mod unix_signals { std::process::exit(139); } - pub unsafe extern "C" fn libaflrs_executor_inmem_handle_timeout( + pub unsafe extern "C" fn libaflrs_executor_inmem_handle_timeout( _sig: c_int, _info: siginfo_t, _void: c_void, @@ -308,7 +308,7 @@ pub mod unix_signals { } #[inline] - pub unsafe fn set_oncrash_ptrs( + pub unsafe fn set_oncrash_ptrs( state: &State, event_mgr: &mut EM, input: &I, @@ -326,14 +326,14 @@ pub mod unix_signals { } #[inline] - pub unsafe fn reset_oncrash_ptrs() { + pub unsafe fn reset_oncrash_ptrs() { CURRENT_INPUT_PTR = ptr::null(); STATE_PTR = ptr::null(); EVENT_MGR_PTR = ptr::null_mut(); } // TODO clearly state that manager should be static (maybe put the 'static lifetime?) - pub unsafe fn setup_crash_handlers() + pub unsafe fn setup_crash_handlers() where EM: EventManager, C: Corpus, @@ -345,7 +345,7 @@ pub mod unix_signals { let mut sa: sigaction = mem::zeroed(); libc::sigemptyset(&mut sa.sa_mask as *mut libc::sigset_t); sa.sa_flags = SA_NODEFER | SA_SIGINFO; - sa.sa_sigaction = libaflrs_executor_inmem_handle_crash:: as usize; + sa.sa_sigaction = libaflrs_executor_inmem_handle_crash:: as usize; for (sig, msg) in &[ (SIGSEGV, "segfault"), (SIGBUS, "sigbus"), @@ -359,7 +359,7 @@ pub mod unix_signals { } } - sa.sa_sigaction = libaflrs_executor_inmem_handle_timeout:: as usize; + sa.sa_sigaction = libaflrs_executor_inmem_handle_timeout:: as usize; if sigaction(SIGUSR2, &mut sa as *mut sigaction, ptr::null_mut()) < 0 { panic!("Could not set up sigusr2 handler for timeouts"); } diff --git a/afl/src/lib.rs b/afl/src/lib.rs index 443756b5c2..44e70c146b 100644 --- a/afl/src/lib.rs +++ b/afl/src/lib.rs @@ -44,7 +44,7 @@ use utils::{current_milliseconds, Rand}; /// The main fuzzer trait. pub trait Fuzzer where - ST: StagesTuple, + ST: StagesTuple, EM: EventManager, E: Executor + HasObservers, OT: ObserversTuple, @@ -96,7 +96,7 @@ where #[derive(Clone, Debug)] pub struct StdFuzzer where - ST: StagesTuple, + ST: StagesTuple, EM: EventManager, E: Executor + HasObservers, OT: ObserversTuple, @@ -112,7 +112,7 @@ where impl Fuzzer for StdFuzzer where - ST: StagesTuple, + ST: StagesTuple, EM: EventManager, E: Executor + HasObservers, OT: ObserversTuple, @@ -132,7 +132,7 @@ where impl StdFuzzer where - ST: StagesTuple, + ST: StagesTuple, EM: EventManager, E: Executor + HasObservers, OT: ObserversTuple, diff --git a/afl/src/stages/mod.rs b/afl/src/stages/mod.rs index 2d99a4e167..74763e3d2b 100644 --- a/afl/src/stages/mod.rs +++ b/afl/src/stages/mod.rs @@ -37,7 +37,7 @@ where ) -> Result<(), AflError>; } -pub trait StagesTuple +pub trait StagesTuple where EM: EventManager, E: Executor + HasObservers, @@ -59,7 +59,7 @@ where fn for_each_mut(&mut self, f: fn(&mut dyn Stage)); } -impl StagesTuple for () +impl StagesTuple for () where EM: EventManager, E: Executor + HasObservers, @@ -83,10 +83,10 @@ where fn for_each_mut(&mut self, _f: fn(&mut dyn Stage)) {} } -impl StagesTuple for (Head, Tail) +impl StagesTuple for (Head, Tail) where Head: Stage, - Tail: StagesTuple + TupleList, + Tail: StagesTuple + TupleList, EM: EventManager, E: Executor + HasObservers, OT: ObserversTuple,