
* Associated types for Corpus, State * cleanup * fix no_std * drop unused clauses * Corpus * cleanup * adding things * fixed fuzzer * remove phantom data * python * progress? * more more * oof * wow it builds? * python fixes, tests * fix python fun * black fmt for python * clippy, added Nop things * fixes * fix merge * make it compile (#836) * doc-test fixes, prelude-b-gone for cargo-hack compat * fixes for windows, concolic * really fix windows, maybe * imagine using windows * ... * elide I generic when used with S: State * Elide many, many generics, but at what cost? * progress on push * Constraint HasCorpus, HasSolutions at trait definition * remove unused feature * remove unstable usage since we constrained HasCorpus at definition * compiled, but still no type inference for MaxMapFeedback * cleanup inprocess * resolve some std conflicts * simplify map * undo unnecessary cfg specification * fix breaking test case for CI on no-std * fix concolic build failures * fix macos build * fixes for windows build * timeout fixes for windows build * fix pybindings issues * fixup qemu * fix outstanding local build issues * maybe fix windows inprocess * doc fixes * unbridled fury * de-associate State from Feedback, replace with generic as AT inference is not sufficient to derive specialisation for MapFeedback * merge update * refactor + speed up fuzzer builds by sharing build work * cleanup lingering compiler errors * lol missed one * revert QEMU-Nyx change, not sure how I did that * move HasInput to inputs * HasInput => KnowsInput * update bounds to enforce via associated types * disentangle observers with fuzzer * revert --target; update some fuzzers to match new API * resolve outstanding fuzzer build blockers (that I can run on my system) * fixes for non-linux unixes * fix for windows * Knows => Uses, final fixes for windows * <guttural screaming> * fixes for concolic * loosen bound for frida executor so windows builds correctly * cleanup generics for eventmanager/eventprocessor to drop observers requirement * improve inference over fuzz_one and friends * update migration notes * fixes for python bindings * fixes for generic counts in event managers * finish migration notes * post-merge fix Co-authored-by: Addison Crump <addison.crump@cispa.de>
106 lines
2.6 KiB
Rust
106 lines
2.6 KiB
Rust
//! A `ShadowExecutor` wraps an executor to have shadow observer that will not be considered by the feedbacks and the manager
|
|
|
|
use core::fmt::{self, Debug, Formatter};
|
|
|
|
use crate::{
|
|
executors::{Executor, ExitKind, HasObservers},
|
|
observers::{ObserversTuple, UsesObservers},
|
|
state::UsesState,
|
|
Error,
|
|
};
|
|
|
|
/// A [`ShadowExecutor`] wraps an executor and a set of shadow observers
|
|
pub struct ShadowExecutor<E, SOT> {
|
|
/// The wrapped executor
|
|
executor: E,
|
|
/// The shadow observers
|
|
shadow_observers: SOT,
|
|
}
|
|
|
|
impl<E, SOT> Debug for ShadowExecutor<E, SOT>
|
|
where
|
|
E: UsesState + Debug,
|
|
SOT: ObserversTuple<E::State> + Debug,
|
|
{
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
|
f.debug_struct("ShadowExecutor")
|
|
.field("executor", &self.executor)
|
|
.field("shadow_observers", &self.shadow_observers)
|
|
.finish()
|
|
}
|
|
}
|
|
|
|
impl<E, SOT> ShadowExecutor<E, SOT>
|
|
where
|
|
E: HasObservers + Debug,
|
|
SOT: ObserversTuple<E::State> + Debug,
|
|
{
|
|
/// Create a new `ShadowExecutor`, wrapping the given `executor`.
|
|
pub fn new(executor: E, shadow_observers: SOT) -> Self {
|
|
Self {
|
|
executor,
|
|
shadow_observers,
|
|
}
|
|
}
|
|
|
|
/// The shadow observers are not considered by the feedbacks and the manager, mutable
|
|
#[inline]
|
|
pub fn shadow_observers(&self) -> &SOT {
|
|
&self.shadow_observers
|
|
}
|
|
|
|
/// The shadow observers are not considered by the feedbacks and the manager, mutable
|
|
#[inline]
|
|
pub fn shadow_observers_mut(&mut self) -> &mut SOT {
|
|
&mut self.shadow_observers
|
|
}
|
|
}
|
|
|
|
impl<E, EM, SOT, Z> Executor<EM, Z> for ShadowExecutor<E, SOT>
|
|
where
|
|
E: Executor<EM, Z> + HasObservers,
|
|
SOT: ObserversTuple<E::State>,
|
|
EM: UsesState<State = E::State>,
|
|
Z: UsesState<State = E::State>,
|
|
{
|
|
fn run_target(
|
|
&mut self,
|
|
fuzzer: &mut Z,
|
|
state: &mut Self::State,
|
|
mgr: &mut EM,
|
|
input: &Self::Input,
|
|
) -> Result<ExitKind, Error> {
|
|
self.executor.run_target(fuzzer, state, mgr, input)
|
|
}
|
|
}
|
|
|
|
impl<E, SOT> UsesState for ShadowExecutor<E, SOT>
|
|
where
|
|
E: UsesState,
|
|
{
|
|
type State = E::State;
|
|
}
|
|
|
|
impl<E, SOT> UsesObservers for ShadowExecutor<E, SOT>
|
|
where
|
|
E: UsesObservers,
|
|
{
|
|
type Observers = E::Observers;
|
|
}
|
|
|
|
impl<E, SOT> HasObservers for ShadowExecutor<E, SOT>
|
|
where
|
|
E: HasObservers,
|
|
SOT: ObserversTuple<E::State>,
|
|
{
|
|
#[inline]
|
|
fn observers(&self) -> &Self::Observers {
|
|
self.executor.observers()
|
|
}
|
|
|
|
#[inline]
|
|
fn observers_mut(&mut self) -> &mut Self::Observers {
|
|
self.executor.observers_mut()
|
|
}
|
|
}
|