No Uses* from fuzzer
(#2761)
* go * fixing stuf * hello from windows * more * lolg * lolf * fix * a --------- Co-authored-by: Your Name <you@example.com>
This commit is contained in:
parent
afc02ee3c2
commit
cc442f4dc8
@ -53,13 +53,12 @@ impl<EM, S, Z> Executor<EM, Z> for CustomExecutor<S>
|
||||
where
|
||||
EM: UsesState<State = S>,
|
||||
S: State + HasExecutions,
|
||||
Z: UsesState<State = S>,
|
||||
Self::Input: HasTargetBytes,
|
||||
{
|
||||
fn run_target(
|
||||
&mut self,
|
||||
_fuzzer: &mut Z,
|
||||
state: &mut Self::State,
|
||||
state: &mut S,
|
||||
_mgr: &mut EM,
|
||||
input: &Self::Input,
|
||||
) -> Result<ExitKind, libafl::Error> {
|
||||
|
@ -312,9 +312,8 @@ impl<M: Monitor> Instance<'_, M> {
|
||||
stages: &mut ST,
|
||||
) -> Result<(), Error>
|
||||
where
|
||||
Z: Fuzzer<E, ClientMgr<M>, ST>
|
||||
+ UsesState<State = ClientState>
|
||||
+ Evaluator<E, ClientMgr<M>, State = ClientState>,
|
||||
Z: Fuzzer<E, ClientMgr<M>, ClientState, ST>
|
||||
+ Evaluator<E, ClientMgr<M>, BytesInput, ClientState>,
|
||||
E: UsesState<State = ClientState>,
|
||||
ST: StagesTuple<E, ClientMgr<M>, ClientState, Z>,
|
||||
{
|
||||
|
@ -357,7 +357,6 @@ pub enum SupportedExecutors<S, OT, FSV> {
|
||||
impl<S, OT, FSV, EM, Z> Executor<EM, Z> for SupportedExecutors<S, OT, FSV>
|
||||
where
|
||||
S: State,
|
||||
Z: UsesState<State = S>,
|
||||
EM: UsesState<State = S>,
|
||||
FSV: Executor<EM, Z, State = S>,
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ use libafl::{
|
||||
CaptureTimeoutFeedback, ConstFeedback, CrashFeedback, MaxMapFeedback, TimeFeedback,
|
||||
},
|
||||
fuzzer::StdFuzzer,
|
||||
inputs::{BytesInput, NopTargetBytesConverter},
|
||||
inputs::{BytesInput, NopTargetBytesConverter, UsesInput},
|
||||
mutators::{havoc_mutations, tokens_mutations, AFLppRedQueen, StdScheduledMutator, Tokens},
|
||||
observers::{CanTrack, HitcountsMapObserver, StdMapObserver, TimeObserver},
|
||||
schedulers::{
|
||||
@ -38,7 +38,6 @@ use libafl::{
|
||||
},
|
||||
state::{
|
||||
HasCorpus, HasCurrentTestcase, HasExecutions, HasLastReportTime, HasStartTime, StdState,
|
||||
UsesState,
|
||||
},
|
||||
Error, Fuzzer, HasFeedback, HasMetadata, SerdeAny,
|
||||
};
|
||||
@ -649,20 +648,19 @@ pub fn fuzzer_target_mode(opt: &Opt) -> Cow<'static, str> {
|
||||
#[derive(Debug, Serialize, Deserialize, SerdeAny)]
|
||||
pub struct IsInitialCorpusEntryMetadata {}
|
||||
|
||||
pub fn run_fuzzer_with_stages<Z, ST, E, EM>(
|
||||
pub fn run_fuzzer_with_stages<E, EM, S, ST, Z>(
|
||||
opt: &Opt,
|
||||
fuzzer: &mut Z,
|
||||
stages: &mut ST,
|
||||
executor: &mut E,
|
||||
state: &mut <Z as UsesState>::State,
|
||||
state: &mut S,
|
||||
mgr: &mut EM,
|
||||
) -> Result<(), Error>
|
||||
where
|
||||
Z: Fuzzer<E, EM, ST>,
|
||||
E: UsesState<State = Z::State>,
|
||||
EM: ProgressReporter<State = Z::State>,
|
||||
ST: StagesTuple<E, EM, Z::State, Z>,
|
||||
<Z as UsesState>::State: HasLastReportTime + HasExecutions + HasMetadata,
|
||||
Z: Fuzzer<E, EM, S, ST>,
|
||||
EM: ProgressReporter<State = S>,
|
||||
ST: StagesTuple<E, EM, S, Z>,
|
||||
S: HasLastReportTime + HasExecutions + HasMetadata + UsesInput,
|
||||
{
|
||||
if opt.bench_just_one {
|
||||
fuzzer.fuzz_loop_for(stages, executor, state, mgr, 1)?;
|
||||
|
@ -77,7 +77,7 @@ where
|
||||
E::Observers: ObserversTuple<E::Input, E::State>,
|
||||
CS: Scheduler<E::Input, E::State> + RemovableScheduler<E::Input, E::State>,
|
||||
EM: EventFirer<State = E::State>,
|
||||
Z: HasScheduler<Scheduler = CS, State = E::State>,
|
||||
Z: HasScheduler<E::Input, E::State, Scheduler = CS>,
|
||||
{
|
||||
// don't delete this else it won't work after restart
|
||||
let current = *state.corpus().current();
|
||||
|
@ -30,6 +30,7 @@ use crate::events::llmp::COMPRESS_THRESHOLD;
|
||||
#[cfg(feature = "scalability_introspection")]
|
||||
use crate::state::HasScalabilityMonitor;
|
||||
use crate::{
|
||||
corpus::Corpus,
|
||||
events::{
|
||||
AdaptiveSerializer, CustomBufEventResult, Event, EventConfig, EventFirer, EventManager,
|
||||
EventManagerHooksTuple, EventManagerId, EventProcessor, EventRestarter,
|
||||
@ -39,7 +40,7 @@ use crate::{
|
||||
fuzzer::{EvaluatorObservers, ExecutionProcessor},
|
||||
inputs::{Input, NopInput, UsesInput},
|
||||
observers::{ObserversTuple, TimeObserver},
|
||||
state::{HasExecutions, HasLastReportTime, NopState, State, Stoppable, UsesState},
|
||||
state::{HasCorpus, HasExecutions, HasLastReportTime, NopState, State, Stoppable, UsesState},
|
||||
Error, HasMetadata,
|
||||
};
|
||||
|
||||
@ -49,8 +50,8 @@ pub(crate) const _LLMP_TAG_TO_MAIN: Tag = Tag(0x3453453);
|
||||
#[derive(Debug)]
|
||||
pub struct CentralizedEventManager<EM, EMH, S, SP>
|
||||
where
|
||||
EM: UsesState,
|
||||
EMH: EventManagerHooksTuple<EM::State>,
|
||||
EM: UsesState<State = S>,
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State,
|
||||
SP: ShMemProvider,
|
||||
{
|
||||
@ -114,8 +115,8 @@ impl CentralizedEventManagerBuilder {
|
||||
time_obs: Option<Handle<TimeObserver>>,
|
||||
) -> Result<CentralizedEventManager<EM, EMH, S, SP>, Error>
|
||||
where
|
||||
EM: UsesState,
|
||||
EMH: EventManagerHooksTuple<EM::State>,
|
||||
EM: UsesState<State = S>,
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State,
|
||||
SP: ShMemProvider,
|
||||
{
|
||||
@ -135,7 +136,6 @@ impl CentralizedEventManagerBuilder {
|
||||
///
|
||||
/// If the port is not yet bound, it will act as a broker; otherwise, it
|
||||
/// will act as a client.
|
||||
#[cfg(feature = "std")]
|
||||
pub fn build_on_port<EM, EMH, S, SP>(
|
||||
self,
|
||||
inner: EM,
|
||||
@ -145,8 +145,8 @@ impl CentralizedEventManagerBuilder {
|
||||
time_obs: Option<Handle<TimeObserver>>,
|
||||
) -> Result<CentralizedEventManager<EM, EMH, S, SP>, Error>
|
||||
where
|
||||
EM: UsesState,
|
||||
EMH: EventManagerHooksTuple<EM::State>,
|
||||
EM: UsesState<State = S>,
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State,
|
||||
SP: ShMemProvider,
|
||||
{
|
||||
@ -165,7 +165,6 @@ impl CentralizedEventManagerBuilder {
|
||||
|
||||
/// If a client respawns, it may reuse the existing connection, previously
|
||||
/// stored by [`LlmpClient::to_env()`].
|
||||
#[cfg(feature = "std")]
|
||||
pub fn build_existing_client_from_env<EM, EMH, S, SP>(
|
||||
self,
|
||||
inner: EM,
|
||||
@ -175,8 +174,8 @@ impl CentralizedEventManagerBuilder {
|
||||
time_obs: Option<Handle<TimeObserver>>,
|
||||
) -> Result<CentralizedEventManager<EM, EMH, S, SP>, Error>
|
||||
where
|
||||
EM: UsesState,
|
||||
EMH: EventManagerHooksTuple<EM::State>,
|
||||
EM: UsesState<State = S>,
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State,
|
||||
SP: ShMemProvider,
|
||||
{
|
||||
@ -193,7 +192,6 @@ impl CentralizedEventManagerBuilder {
|
||||
}
|
||||
|
||||
/// Create an existing client from description
|
||||
#[cfg(feature = "std")]
|
||||
pub fn existing_client_from_description<EM, EMH, S, SP>(
|
||||
self,
|
||||
inner: EM,
|
||||
@ -203,8 +201,8 @@ impl CentralizedEventManagerBuilder {
|
||||
time_obs: Option<Handle<TimeObserver>>,
|
||||
) -> Result<CentralizedEventManager<EM, EMH, S, SP>, Error>
|
||||
where
|
||||
EM: UsesState,
|
||||
EMH: EventManagerHooksTuple<EM::State>,
|
||||
EM: UsesState<State = S>,
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State,
|
||||
SP: ShMemProvider,
|
||||
{
|
||||
@ -222,8 +220,8 @@ impl CentralizedEventManagerBuilder {
|
||||
}
|
||||
impl<EM, EMH, S, SP> UsesState for CentralizedEventManager<EM, EMH, S, SP>
|
||||
where
|
||||
EM: UsesState,
|
||||
EMH: EventManagerHooksTuple<EM::State>,
|
||||
EM: UsesState<State = S>,
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State,
|
||||
SP: ShMemProvider,
|
||||
{
|
||||
@ -232,8 +230,8 @@ where
|
||||
|
||||
impl<EM, EMH, S, SP> AdaptiveSerializer for CentralizedEventManager<EM, EMH, S, SP>
|
||||
where
|
||||
EM: AdaptiveSerializer + UsesState,
|
||||
EMH: EventManagerHooksTuple<EM::State>,
|
||||
EM: AdaptiveSerializer + UsesState<State = S>,
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State,
|
||||
SP: ShMemProvider,
|
||||
{
|
||||
@ -270,9 +268,10 @@ where
|
||||
|
||||
impl<EM, EMH, S, SP> EventFirer for CentralizedEventManager<EM, EMH, S, SP>
|
||||
where
|
||||
EM: AdaptiveSerializer + EventFirer + HasEventManagerId,
|
||||
EMH: EventManagerHooksTuple<EM::State>,
|
||||
S: State,
|
||||
EM: AdaptiveSerializer + EventFirer<State = S> + HasEventManagerId,
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State + HasCorpus,
|
||||
S::Corpus: Corpus<Input = S::Input>,
|
||||
SP: ShMemProvider,
|
||||
{
|
||||
fn should_send(&self) -> bool {
|
||||
@ -342,8 +341,8 @@ where
|
||||
|
||||
impl<EM, EMH, S, SP> EventRestarter for CentralizedEventManager<EM, EMH, S, SP>
|
||||
where
|
||||
EM: EventRestarter,
|
||||
EMH: EventManagerHooksTuple<EM::State>,
|
||||
EM: EventRestarter<State = S>,
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State,
|
||||
SP: ShMemProvider,
|
||||
{
|
||||
@ -368,17 +367,18 @@ where
|
||||
|
||||
impl<E, EM, EMH, S, SP, Z> EventProcessor<E, Z> for CentralizedEventManager<EM, EMH, S, SP>
|
||||
where
|
||||
EM: AdaptiveSerializer + EventProcessor<E, Z> + EventFirer + HasEventManagerId,
|
||||
EMH: EventManagerHooksTuple<EM::State>,
|
||||
EM: AdaptiveSerializer + EventProcessor<E, Z> + EventFirer<State = S> + HasEventManagerId,
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
E: HasObservers + Executor<Self, Z, State = Self::State>,
|
||||
E::Observers:
|
||||
ObserversTuple<<Self as UsesInput>::Input, <Self as UsesState>::State> + Serialize,
|
||||
for<'a> E::Observers: Deserialize<'a>,
|
||||
S: State,
|
||||
S: State + HasCorpus,
|
||||
S::Corpus: Corpus<Input = S::Input>,
|
||||
Self::State: HasExecutions + HasMetadata,
|
||||
SP: ShMemProvider,
|
||||
Z: EvaluatorObservers<Self, E::Observers, State = Self::State>
|
||||
+ ExecutionProcessor<Self, E::Observers, State = Self::State>,
|
||||
Z: EvaluatorObservers<E, Self, <S::Corpus as Corpus>::Input, S>
|
||||
+ ExecutionProcessor<Self, <S::Corpus as Corpus>::Input, E::Observers, S>,
|
||||
{
|
||||
fn process(
|
||||
&mut self,
|
||||
@ -408,20 +408,21 @@ where
|
||||
E::Observers:
|
||||
ObserversTuple<<Self as UsesInput>::Input, <Self as UsesState>::State> + Serialize,
|
||||
for<'a> E::Observers: Deserialize<'a>,
|
||||
EM: AdaptiveSerializer + EventManager<E, Z>,
|
||||
EM: AdaptiveSerializer + EventManager<E, Z, State = S>,
|
||||
EM::State: HasExecutions + HasMetadata + HasLastReportTime,
|
||||
EMH: EventManagerHooksTuple<EM::State>,
|
||||
S: State,
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State + HasCorpus,
|
||||
S::Corpus: Corpus<Input = S::Input>,
|
||||
SP: ShMemProvider,
|
||||
Z: EvaluatorObservers<Self, E::Observers, State = Self::State>
|
||||
+ ExecutionProcessor<Self, E::Observers, State = Self::State>,
|
||||
Z: EvaluatorObservers<E, Self, <S::Corpus as Corpus>::Input, S>
|
||||
+ ExecutionProcessor<Self, <S::Corpus as Corpus>::Input, E::Observers, S>,
|
||||
{
|
||||
}
|
||||
|
||||
impl<EM, EMH, S, SP> HasCustomBufHandlers for CentralizedEventManager<EM, EMH, S, SP>
|
||||
where
|
||||
EM: HasCustomBufHandlers,
|
||||
EMH: EventManagerHooksTuple<EM::State>,
|
||||
EM: HasCustomBufHandlers<State = S>,
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State,
|
||||
SP: ShMemProvider,
|
||||
{
|
||||
@ -438,19 +439,21 @@ where
|
||||
|
||||
impl<EM, EMH, S, SP> ProgressReporter for CentralizedEventManager<EM, EMH, S, SP>
|
||||
where
|
||||
EM: AdaptiveSerializer + ProgressReporter + HasEventManagerId,
|
||||
EM: AdaptiveSerializer + ProgressReporter<State = S> + HasEventManagerId,
|
||||
EM::State: HasMetadata + HasExecutions + HasLastReportTime,
|
||||
EMH: EventManagerHooksTuple<EM::State>,
|
||||
S: State,
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State + HasCorpus,
|
||||
S::Corpus: Corpus<Input = S::Input>,
|
||||
SP: ShMemProvider,
|
||||
{
|
||||
}
|
||||
|
||||
impl<EM, EMH, S, SP> HasEventManagerId for CentralizedEventManager<EM, EMH, S, SP>
|
||||
where
|
||||
EM: HasEventManagerId + UsesState,
|
||||
EMH: EventManagerHooksTuple<EM::State>,
|
||||
S: State,
|
||||
EM: HasEventManagerId + UsesState<State = S>,
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State + HasCorpus,
|
||||
S::Corpus: Corpus<Input = S::Input>,
|
||||
SP: ShMemProvider,
|
||||
{
|
||||
fn mgr_id(&self) -> EventManagerId {
|
||||
@ -460,9 +463,10 @@ where
|
||||
|
||||
impl<EM, EMH, S, SP> CentralizedEventManager<EM, EMH, S, SP>
|
||||
where
|
||||
EM: UsesState,
|
||||
EMH: EventManagerHooksTuple<EM::State>,
|
||||
S: State,
|
||||
EM: UsesState<State = S>,
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State + HasCorpus,
|
||||
S::Corpus: Corpus<Input = S::Input>,
|
||||
SP: ShMemProvider,
|
||||
{
|
||||
/// Describe the client event manager's LLMP parts in a restorable fashion
|
||||
@ -472,7 +476,6 @@ where
|
||||
|
||||
/// Write the config for a client [`EventManager`] to env vars, a new
|
||||
/// client can reattach using [`CentralizedEventManagerBuilder::build_existing_client_from_env()`].
|
||||
#[cfg(feature = "std")]
|
||||
pub fn to_env(&self, env_name: &str) {
|
||||
self.client.to_env(env_name).unwrap();
|
||||
}
|
||||
@ -485,9 +488,10 @@ where
|
||||
|
||||
impl<EM, EMH, S, SP> CentralizedEventManager<EM, EMH, S, SP>
|
||||
where
|
||||
EM: UsesState + EventFirer + AdaptiveSerializer + HasEventManagerId,
|
||||
EMH: EventManagerHooksTuple<EM::State>,
|
||||
S: State + Stoppable,
|
||||
EM: UsesState<State = S> + EventFirer + AdaptiveSerializer + HasEventManagerId,
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State + Stoppable + HasCorpus,
|
||||
S::Corpus: Corpus<Input = S::Input>,
|
||||
SP: ShMemProvider,
|
||||
{
|
||||
#[cfg(feature = "llmp_compression")]
|
||||
@ -535,8 +539,8 @@ where
|
||||
ObserversTuple<<Self as UsesInput>::Input, <Self as UsesState>::State> + Serialize,
|
||||
<Self as UsesState>::State: UsesInput + HasExecutions + HasMetadata,
|
||||
for<'a> E::Observers: Deserialize<'a>,
|
||||
Z: ExecutionProcessor<Self, E::Observers, State = <Self as UsesState>::State>
|
||||
+ EvaluatorObservers<Self, E::Observers>,
|
||||
Z: EvaluatorObservers<E, Self, <S::Corpus as Corpus>::Input, S>
|
||||
+ ExecutionProcessor<Self, <S::Corpus as Corpus>::Input, E::Observers, S>,
|
||||
{
|
||||
// TODO: Get around local event copy by moving handle_in_client
|
||||
let self_id = self.client.sender().id();
|
||||
@ -585,8 +589,8 @@ where
|
||||
ObserversTuple<<Self as UsesInput>::Input, <Self as UsesState>::State> + Serialize,
|
||||
<Self as UsesState>::State: UsesInput + HasExecutions + HasMetadata,
|
||||
for<'a> E::Observers: Deserialize<'a> + Serialize,
|
||||
Z: ExecutionProcessor<Self, E::Observers, State = <Self as UsesState>::State>
|
||||
+ EvaluatorObservers<Self, E::Observers>,
|
||||
Z: EvaluatorObservers<E, Self, <S::Corpus as Corpus>::Input, S>
|
||||
+ ExecutionProcessor<Self, <S::Corpus as Corpus>::Input, E::Observers, S>,
|
||||
{
|
||||
log::debug!("handle_in_main!");
|
||||
|
||||
@ -640,7 +644,7 @@ where
|
||||
process::id(),
|
||||
event_name
|
||||
);
|
||||
fuzzer.evaluate_input_with_observers::<E>(
|
||||
fuzzer.evaluate_input_with_observers(
|
||||
state,
|
||||
executor,
|
||||
self,
|
||||
|
@ -30,6 +30,7 @@ use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "llmp_compression")]
|
||||
use crate::events::llmp::COMPRESS_THRESHOLD;
|
||||
use crate::{
|
||||
corpus::Corpus,
|
||||
events::{
|
||||
llmp::{LLMP_TAG_EVENT_TO_BOTH, _LLMP_TAG_EVENT_TO_BROKER},
|
||||
AdaptiveSerializer, CustomBufEventResult, CustomBufHandlerFn, Event, EventConfig,
|
||||
@ -40,7 +41,7 @@ use crate::{
|
||||
fuzzer::{Evaluator, EvaluatorObservers, ExecutionProcessor},
|
||||
inputs::{NopInput, UsesInput},
|
||||
observers::{ObserversTuple, TimeObserver},
|
||||
state::{HasExecutions, HasImported, HasLastReportTime, NopState, State, UsesState},
|
||||
state::{HasCorpus, HasExecutions, HasImported, HasLastReportTime, NopState, State, UsesState},
|
||||
Error, HasMetadata,
|
||||
};
|
||||
|
||||
@ -387,7 +388,8 @@ where
|
||||
impl<EMH, S, SP> LlmpEventManager<EMH, S, SP>
|
||||
where
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State + HasExecutions + HasMetadata + HasImported,
|
||||
S: State + HasExecutions + HasMetadata + HasImported + HasCorpus,
|
||||
S::Corpus: Corpus<Input = S::Input>,
|
||||
SP: ShMemProvider,
|
||||
{
|
||||
// Handle arriving events in the client
|
||||
@ -404,9 +406,9 @@ where
|
||||
E: Executor<Self, Z, State = S> + HasObservers,
|
||||
E::Observers: ObserversTuple<S::Input, S> + Serialize,
|
||||
for<'a> E::Observers: Deserialize<'a>,
|
||||
Z: ExecutionProcessor<Self, E::Observers, State = S>
|
||||
+ EvaluatorObservers<Self, E::Observers>
|
||||
+ Evaluator<E, Self>,
|
||||
Z: ExecutionProcessor<Self, <S::Corpus as Corpus>::Input, E::Observers, S>
|
||||
+ EvaluatorObservers<E, Self, <S::Corpus as Corpus>::Input, S>
|
||||
+ Evaluator<E, Self, <S::Corpus as Corpus>::Input, S>,
|
||||
{
|
||||
if !self.hooks.pre_exec_all(state, client_id, &event)? {
|
||||
return Ok(());
|
||||
@ -449,9 +451,7 @@ where
|
||||
{
|
||||
state.scalability_monitor_mut().testcase_without_observers += 1;
|
||||
}
|
||||
fuzzer.evaluate_input_with_observers::<E>(
|
||||
state, executor, self, input, false,
|
||||
)?
|
||||
fuzzer.evaluate_input_with_observers(state, executor, self, input, false)?
|
||||
};
|
||||
if let Some(item) = res.1 {
|
||||
*state.imported_mut() += 1;
|
||||
@ -585,14 +585,15 @@ where
|
||||
impl<E, EMH, S, SP, Z> EventProcessor<E, Z> for LlmpEventManager<EMH, S, SP>
|
||||
where
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State + HasExecutions + HasMetadata + HasImported,
|
||||
S: State + HasExecutions + HasMetadata + HasImported + HasCorpus,
|
||||
S::Corpus: Corpus<Input = S::Input>,
|
||||
SP: ShMemProvider,
|
||||
E: HasObservers + Executor<Self, Z, State = S>,
|
||||
E::Observers: ObserversTuple<S::Input, S> + Serialize,
|
||||
for<'a> E::Observers: Deserialize<'a>,
|
||||
Z: ExecutionProcessor<Self, E::Observers, State = S>
|
||||
+ EvaluatorObservers<Self, E::Observers>
|
||||
+ Evaluator<E, Self>,
|
||||
Z: ExecutionProcessor<Self, <S::Corpus as Corpus>::Input, E::Observers, S>
|
||||
+ EvaluatorObservers<E, Self, <S::Corpus as Corpus>::Input, S>
|
||||
+ Evaluator<E, Self, <S::Corpus as Corpus>::Input, S>,
|
||||
{
|
||||
fn process(
|
||||
&mut self,
|
||||
@ -649,11 +650,12 @@ where
|
||||
E::Observers: ObserversTuple<S::Input, S> + Serialize,
|
||||
for<'a> E::Observers: Deserialize<'a>,
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State + HasExecutions + HasMetadata + HasLastReportTime + HasImported,
|
||||
S: State + HasExecutions + HasMetadata + HasLastReportTime + HasImported + HasCorpus,
|
||||
S::Corpus: Corpus<Input = S::Input>,
|
||||
SP: ShMemProvider,
|
||||
Z: ExecutionProcessor<Self, E::Observers, State = S>
|
||||
+ EvaluatorObservers<Self, E::Observers>
|
||||
+ Evaluator<E, Self>,
|
||||
Z: ExecutionProcessor<Self, <S::Corpus as Corpus>::Input, E::Observers, S>
|
||||
+ EvaluatorObservers<E, Self, <S::Corpus as Corpus>::Input, S>
|
||||
+ Evaluator<E, Self, <S::Corpus as Corpus>::Input, S>,
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -16,11 +16,12 @@ use libafl_bolts::{
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::{
|
||||
corpus::Corpus,
|
||||
events::{CustomBufEventResult, CustomBufHandlerFn, Event, EventFirer},
|
||||
executors::{Executor, HasObservers},
|
||||
fuzzer::{EvaluatorObservers, ExecutionProcessor},
|
||||
inputs::{Input, InputConverter, NopInput, NopInputConverter, UsesInput},
|
||||
state::{HasExecutions, NopState, State, Stoppable, UsesState},
|
||||
state::{HasCorpus, HasExecutions, NopState, State, Stoppable, UsesState},
|
||||
Error, HasMetadata,
|
||||
};
|
||||
|
||||
@ -253,7 +254,7 @@ where
|
||||
|
||||
impl<DI, IC, ICB, S, SP> LlmpEventConverter<DI, IC, ICB, S, SP>
|
||||
where
|
||||
S: UsesInput + HasExecutions + HasMetadata + Stoppable,
|
||||
S: UsesInput + HasExecutions + HasMetadata + Stoppable + HasCorpus,
|
||||
SP: ShMemProvider,
|
||||
IC: InputConverter<From = S::Input, To = DI>,
|
||||
ICB: InputConverter<From = DI, To = S::Input>,
|
||||
@ -295,8 +296,10 @@ where
|
||||
where
|
||||
E: Executor<EM, Z, State = S> + HasObservers,
|
||||
EM: UsesState<State = S> + EventFirer,
|
||||
S::Corpus: Corpus<Input = S::Input>,
|
||||
for<'a> E::Observers: Deserialize<'a>,
|
||||
Z: ExecutionProcessor<EM, E::Observers, State = S> + EvaluatorObservers<EM, E::Observers>,
|
||||
Z: ExecutionProcessor<EM, <S::Corpus as Corpus>::Input, E::Observers, S>
|
||||
+ EvaluatorObservers<E, EM, <S::Corpus as Corpus>::Input, S>,
|
||||
{
|
||||
match event {
|
||||
Event::NewTestcase {
|
||||
@ -308,7 +311,7 @@ where
|
||||
return Ok(());
|
||||
};
|
||||
|
||||
let res = fuzzer.evaluate_input_with_observers::<E>(
|
||||
let res = fuzzer.evaluate_input_with_observers(
|
||||
state,
|
||||
executor,
|
||||
manager,
|
||||
@ -349,8 +352,10 @@ where
|
||||
where
|
||||
E: Executor<EM, Z, State = S> + HasObservers,
|
||||
EM: UsesState<State = S> + EventFirer,
|
||||
S::Corpus: Corpus<Input = S::Input>,
|
||||
for<'a> E::Observers: Deserialize<'a>,
|
||||
Z: ExecutionProcessor<EM, E::Observers, State = S> + EvaluatorObservers<EM, E::Observers>,
|
||||
Z: ExecutionProcessor<EM, <S::Corpus as Corpus>::Input, E::Observers, S>
|
||||
+ EvaluatorObservers<E, EM, <S::Corpus as Corpus>::Input, S>,
|
||||
{
|
||||
// TODO: Get around local event copy by moving handle_in_client
|
||||
let self_id = self.llmp.sender().id();
|
||||
|
@ -4,56 +4,51 @@
|
||||
//! restart/refork it.
|
||||
|
||||
use alloc::{boxed::Box, vec::Vec};
|
||||
#[cfg(feature = "std")]
|
||||
use core::sync::atomic::{compiler_fence, Ordering};
|
||||
#[cfg(feature = "std")]
|
||||
use core::time::Duration;
|
||||
use core::{marker::PhantomData, num::NonZeroUsize};
|
||||
#[cfg(feature = "std")]
|
||||
use core::{
|
||||
marker::PhantomData,
|
||||
num::NonZeroUsize,
|
||||
sync::atomic::{compiler_fence, Ordering},
|
||||
time::Duration,
|
||||
};
|
||||
use std::net::SocketAddr;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
use libafl_bolts::core_affinity::CoreId;
|
||||
#[cfg(all(feature = "std", any(windows, not(feature = "fork"))))]
|
||||
#[cfg(any(windows, not(feature = "fork")))]
|
||||
use libafl_bolts::os::startable_self;
|
||||
#[cfg(all(unix, feature = "std", not(miri)))]
|
||||
#[cfg(all(unix, not(miri)))]
|
||||
use libafl_bolts::os::unix_signals::setup_signal_handler;
|
||||
#[cfg(all(feature = "std", feature = "fork", unix))]
|
||||
#[cfg(all(feature = "fork", unix))]
|
||||
use libafl_bolts::os::{fork, ForkResult};
|
||||
#[cfg(feature = "std")]
|
||||
use libafl_bolts::{
|
||||
llmp::LlmpConnection, os::CTRL_C_EXIT, shmem::StdShMemProvider, staterestore::StateRestorer,
|
||||
};
|
||||
use libafl_bolts::{
|
||||
llmp::{Broker, LlmpBroker},
|
||||
shmem::ShMemProvider,
|
||||
core_affinity::CoreId,
|
||||
llmp::{Broker, LlmpBroker, LlmpConnection},
|
||||
os::CTRL_C_EXIT,
|
||||
shmem::{ShMemProvider, StdShMemProvider},
|
||||
staterestore::StateRestorer,
|
||||
tuples::{tuple_list, Handle},
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "std")]
|
||||
use typed_builder::TypedBuilder;
|
||||
|
||||
#[cfg(all(unix, feature = "std", not(miri)))]
|
||||
#[cfg(all(unix, not(miri)))]
|
||||
use crate::events::EVENTMGR_SIGHANDLER_STATE;
|
||||
#[cfg(feature = "std")]
|
||||
use crate::events::{AdaptiveSerializer, CustomBufEventResult, HasCustomBufHandlers};
|
||||
use crate::{
|
||||
corpus::Corpus,
|
||||
events::{
|
||||
launcher::ClientDescription, Event, EventConfig, EventFirer, EventManager,
|
||||
EventManagerHooksTuple, EventManagerId, EventProcessor, EventRestarter, HasEventManagerId,
|
||||
LlmpEventManager, LlmpShouldSaveState, ProgressReporter, StdLlmpEventHook,
|
||||
launcher::ClientDescription, AdaptiveSerializer, CustomBufEventResult, Event, EventConfig,
|
||||
EventFirer, EventManager, EventManagerHooksTuple, EventManagerId, EventProcessor,
|
||||
EventRestarter, HasCustomBufHandlers, HasEventManagerId, LlmpEventManager,
|
||||
LlmpShouldSaveState, ProgressReporter, StdLlmpEventHook,
|
||||
},
|
||||
executors::{Executor, HasObservers},
|
||||
fuzzer::{Evaluator, EvaluatorObservers, ExecutionProcessor},
|
||||
inputs::UsesInput,
|
||||
monitors::Monitor,
|
||||
observers::{ObserversTuple, TimeObserver},
|
||||
state::{HasExecutions, HasImported, HasLastReportTime, State, UsesState},
|
||||
state::{HasCorpus, HasExecutions, HasImported, HasLastReportTime, State, UsesState},
|
||||
Error, HasMetadata,
|
||||
};
|
||||
|
||||
/// A manager that can restart on the fly, storing states in-between (in `on_restart`)
|
||||
#[cfg(feature = "std")]
|
||||
#[derive(Debug)]
|
||||
pub struct LlmpRestartingEventManager<EMH, S, SP>
|
||||
where
|
||||
@ -69,7 +64,6 @@ where
|
||||
save_state: LlmpShouldSaveState,
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<EMH, S, SP> AdaptiveSerializer for LlmpRestartingEventManager<EMH, S, SP>
|
||||
where
|
||||
SP: ShMemProvider,
|
||||
@ -106,7 +100,6 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<EMH, S, SP> UsesState for LlmpRestartingEventManager<EMH, S, SP>
|
||||
where
|
||||
S: State,
|
||||
@ -115,7 +108,6 @@ where
|
||||
type State = S;
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<EMH, S, SP> ProgressReporter for LlmpRestartingEventManager<EMH, S, SP>
|
||||
where
|
||||
S: State + HasExecutions + HasMetadata + HasLastReportTime,
|
||||
@ -123,7 +115,6 @@ where
|
||||
{
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<EMH, S, SP> EventFirer for LlmpRestartingEventManager<EMH, S, SP>
|
||||
where
|
||||
SP: ShMemProvider,
|
||||
@ -157,7 +148,6 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<EMH, S, SP> EventRestarter for LlmpRestartingEventManager<EMH, S, SP>
|
||||
where
|
||||
S: State + HasExecutions,
|
||||
@ -199,18 +189,22 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<E, EMH, S, SP, Z> EventProcessor<E, Z> for LlmpRestartingEventManager<EMH, S, SP>
|
||||
where
|
||||
E: HasObservers + Executor<LlmpEventManager<EMH, S, SP>, Z, State = S>,
|
||||
E::Observers: ObserversTuple<S::Input, S> + Serialize,
|
||||
for<'a> E::Observers: Deserialize<'a>,
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State + HasExecutions + HasMetadata + HasImported,
|
||||
S: State + HasExecutions + HasMetadata + HasImported + HasCorpus,
|
||||
S::Corpus: Corpus<Input = S::Input>,
|
||||
SP: ShMemProvider,
|
||||
Z: ExecutionProcessor<LlmpEventManager<EMH, S, SP>, E::Observers, State = S>
|
||||
+ EvaluatorObservers<LlmpEventManager<EMH, S, SP>, E::Observers>
|
||||
+ Evaluator<E, LlmpEventManager<EMH, S, SP>>,
|
||||
Z: ExecutionProcessor<
|
||||
LlmpEventManager<EMH, S, SP>,
|
||||
<S::Corpus as Corpus>::Input,
|
||||
E::Observers,
|
||||
S,
|
||||
> + EvaluatorObservers<E, LlmpEventManager<EMH, S, SP>, <S::Corpus as Corpus>::Input, S>
|
||||
+ Evaluator<E, LlmpEventManager<EMH, S, SP>, <S::Corpus as Corpus>::Input, S>,
|
||||
{
|
||||
fn process(&mut self, fuzzer: &mut Z, state: &mut S, executor: &mut E) -> Result<usize, Error> {
|
||||
let res = self.llmp_mgr.process(fuzzer, state, executor)?;
|
||||
@ -223,22 +217,25 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<E, EMH, S, SP, Z> EventManager<E, Z> for LlmpRestartingEventManager<EMH, S, SP>
|
||||
where
|
||||
E: HasObservers + Executor<LlmpEventManager<EMH, S, SP>, Z, State = S>,
|
||||
E::Observers: ObserversTuple<S::Input, S> + Serialize,
|
||||
for<'a> E::Observers: Deserialize<'a>,
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State + HasExecutions + HasMetadata + HasLastReportTime + HasImported,
|
||||
S: State + HasExecutions + HasMetadata + HasLastReportTime + HasImported + HasCorpus,
|
||||
S::Corpus: Corpus<Input = S::Input>,
|
||||
SP: ShMemProvider,
|
||||
Z: ExecutionProcessor<LlmpEventManager<EMH, S, SP>, E::Observers, State = S>
|
||||
+ EvaluatorObservers<LlmpEventManager<EMH, S, SP>, E::Observers>
|
||||
+ Evaluator<E, LlmpEventManager<EMH, S, SP>>,
|
||||
Z: ExecutionProcessor<
|
||||
LlmpEventManager<EMH, S, SP>,
|
||||
<S::Corpus as Corpus>::Input,
|
||||
E::Observers,
|
||||
S,
|
||||
> + EvaluatorObservers<E, LlmpEventManager<EMH, S, SP>, <S::Corpus as Corpus>::Input, S>
|
||||
+ Evaluator<E, LlmpEventManager<EMH, S, SP>, <S::Corpus as Corpus>::Input, S>,
|
||||
{
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<EMH, S, SP> HasEventManagerId for LlmpRestartingEventManager<EMH, S, SP>
|
||||
where
|
||||
S: State,
|
||||
@ -249,7 +246,6 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<EMH, S, SP> HasCustomBufHandlers for LlmpRestartingEventManager<EMH, S, SP>
|
||||
where
|
||||
S: State,
|
||||
@ -269,7 +265,6 @@ const _ENV_FUZZER_RECEIVER: &str = "_AFL_ENV_FUZZER_RECEIVER";
|
||||
/// The llmp (2 way) connection from a fuzzer to the broker (broadcasting all other fuzzer messages)
|
||||
const _ENV_FUZZER_BROKER_CLIENT_INITIAL: &str = "_AFL_ENV_FUZZER_BROKER_CLIENT";
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<EMH, S, SP> LlmpRestartingEventManager<EMH, S, SP>
|
||||
where
|
||||
S: State,
|
||||
@ -321,7 +316,6 @@ where
|
||||
}
|
||||
|
||||
/// The kind of manager we're creating right now
|
||||
#[cfg(feature = "std")]
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum ManagerKind {
|
||||
/// Any kind will do
|
||||
@ -339,7 +333,6 @@ pub enum ManagerKind {
|
||||
///
|
||||
/// The restarting mgr is a combination of restarter and runner, that can be used on systems with and without `fork` support.
|
||||
/// The restarter will spawn a new process each time the child crashes or timeouts.
|
||||
#[cfg(feature = "std")]
|
||||
#[allow(clippy::type_complexity)]
|
||||
pub fn setup_restarting_mgr_std<MT, S>(
|
||||
monitor: MT,
|
||||
@ -371,7 +364,6 @@ where
|
||||
/// The restarting mgr is a combination of restarter and runner, that can be used on systems with and without `fork` support.
|
||||
/// The restarter will spawn a new process each time the child crashes or timeouts.
|
||||
/// This one, additionally uses the timeobserver for the adaptive serialization
|
||||
#[cfg(feature = "std")]
|
||||
#[allow(clippy::type_complexity)]
|
||||
pub fn setup_restarting_mgr_std_adaptive<MT, S>(
|
||||
monitor: MT,
|
||||
@ -405,7 +397,6 @@ where
|
||||
/// The [`RestartingMgr`] is is a combination of a
|
||||
/// `restarter` and `runner`, that can be used on systems both with and without `fork` support. The
|
||||
/// `restarter` will start a new process each time the child crashes or times out.
|
||||
#[cfg(feature = "std")]
|
||||
#[allow(clippy::default_trait_access, clippy::ignored_unit_patterns)]
|
||||
#[derive(TypedBuilder, Debug)]
|
||||
pub struct RestartingMgr<EMH, MT, S, SP> {
|
||||
@ -448,7 +439,6 @@ pub struct RestartingMgr<EMH, MT, S, SP> {
|
||||
phantom_data: PhantomData<(EMH, S)>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[allow(clippy::type_complexity, clippy::too_many_lines)]
|
||||
impl<EMH, MT, S, SP> RestartingMgr<EMH, MT, S, SP>
|
||||
where
|
||||
@ -719,7 +709,6 @@ where
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
#[cfg(feature = "std")]
|
||||
mod tests {
|
||||
use core::sync::atomic::{compiler_fence, Ordering};
|
||||
|
||||
|
@ -16,32 +16,33 @@ use std::{
|
||||
|
||||
#[cfg(feature = "tcp_compression")]
|
||||
use libafl_bolts::compress::GzipCompressor;
|
||||
#[cfg(feature = "std")]
|
||||
use libafl_bolts::core_affinity::CoreId;
|
||||
#[cfg(all(feature = "std", any(windows, not(feature = "fork"))))]
|
||||
#[cfg(any(windows, not(feature = "fork")))]
|
||||
use libafl_bolts::os::startable_self;
|
||||
#[cfg(all(unix, feature = "std", not(miri)))]
|
||||
#[cfg(all(unix, not(miri)))]
|
||||
use libafl_bolts::os::unix_signals::setup_signal_handler;
|
||||
#[cfg(feature = "std")]
|
||||
use libafl_bolts::os::CTRL_C_EXIT;
|
||||
#[cfg(all(feature = "std", feature = "fork", unix))]
|
||||
#[cfg(all(feature = "fork", unix))]
|
||||
use libafl_bolts::os::{fork, ForkResult};
|
||||
use libafl_bolts::{shmem::ShMemProvider, tuples::tuple_list, ClientId};
|
||||
#[cfg(feature = "std")]
|
||||
use libafl_bolts::{shmem::StdShMemProvider, staterestore::StateRestorer};
|
||||
use libafl_bolts::{
|
||||
core_affinity::CoreId,
|
||||
os::CTRL_C_EXIT,
|
||||
shmem::{ShMemProvider, StdShMemProvider},
|
||||
staterestore::StateRestorer,
|
||||
tuples::tuple_list,
|
||||
ClientId,
|
||||
};
|
||||
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||
use tokio::{
|
||||
io::{AsyncReadExt, AsyncWriteExt},
|
||||
sync::{broadcast, broadcast::error::RecvError, mpsc},
|
||||
task::{spawn, JoinHandle},
|
||||
};
|
||||
#[cfg(feature = "std")]
|
||||
use typed_builder::TypedBuilder;
|
||||
|
||||
use super::{CustomBufEventResult, CustomBufHandlerFn};
|
||||
#[cfg(all(unix, feature = "std", not(miri)))]
|
||||
#[cfg(all(unix, not(miri)))]
|
||||
use crate::events::EVENTMGR_SIGHANDLER_STATE;
|
||||
use crate::{
|
||||
corpus::Corpus,
|
||||
events::{
|
||||
BrokerEventResult, Event, EventConfig, EventFirer, EventManager, EventManagerHooksTuple,
|
||||
EventManagerId, EventProcessor, EventRestarter, HasCustomBufHandlers, HasEventManagerId,
|
||||
@ -52,7 +53,7 @@ use crate::{
|
||||
inputs::{Input, UsesInput},
|
||||
monitors::Monitor,
|
||||
observers::ObserversTuple,
|
||||
state::{HasExecutions, HasImported, HasLastReportTime, State, UsesState},
|
||||
state::{HasCorpus, HasExecutions, HasImported, HasLastReportTime, State, UsesState},
|
||||
Error, HasMetadata,
|
||||
};
|
||||
|
||||
@ -583,7 +584,8 @@ where
|
||||
impl<EMH, S> TcpEventManager<EMH, S>
|
||||
where
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State + HasExecutions + HasMetadata + HasImported,
|
||||
S: State + HasExecutions + HasMetadata + HasImported + HasCorpus,
|
||||
S::Corpus: Corpus<Input = S::Input>,
|
||||
{
|
||||
/// Write the client id for a client [`EventManager`] to env vars
|
||||
pub fn to_env(&self, env_name: &str) {
|
||||
@ -604,8 +606,8 @@ where
|
||||
E: Executor<Self, Z, State = S> + HasObservers,
|
||||
E::Observers: Serialize + ObserversTuple<S::Input, S>,
|
||||
for<'a> E::Observers: Deserialize<'a>,
|
||||
Z: ExecutionProcessor<Self, E::Observers, State = S>
|
||||
+ EvaluatorObservers<Self, E::Observers>,
|
||||
Z: ExecutionProcessor<Self, <S::Corpus as Corpus>::Input, E::Observers, S>
|
||||
+ EvaluatorObservers<E, Self, <S::Corpus as Corpus>::Input, S>,
|
||||
{
|
||||
if !self.hooks.pre_exec_all(state, client_id, &event)? {
|
||||
return Ok(());
|
||||
@ -636,8 +638,7 @@ where
|
||||
{
|
||||
state.scalability_monitor_mut().testcase_without_observers += 1;
|
||||
}
|
||||
fuzzer
|
||||
.evaluate_input_with_observers::<E>(state, executor, self, input, false)?
|
||||
fuzzer.evaluate_input_with_observers(state, executor, self, input, false)?
|
||||
};
|
||||
if let Some(item) = _res.1 {
|
||||
*state.imported_mut() += 1;
|
||||
@ -745,9 +746,10 @@ where
|
||||
E::Observers: Serialize + ObserversTuple<S::Input, S>,
|
||||
for<'a> E::Observers: Deserialize<'a>,
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State + HasExecutions + HasMetadata + HasImported,
|
||||
Z: EvaluatorObservers<Self, E::Observers, State = S>
|
||||
+ ExecutionProcessor<Self, E::Observers, State = S>,
|
||||
S: State + HasExecutions + HasMetadata + HasImported + HasCorpus,
|
||||
S::Corpus: Corpus<Input = S::Input>,
|
||||
Z: ExecutionProcessor<Self, <S::Corpus as Corpus>::Input, E::Observers, S>
|
||||
+ EvaluatorObservers<E, Self, <S::Corpus as Corpus>::Input, S>,
|
||||
{
|
||||
fn process(
|
||||
&mut self,
|
||||
@ -820,9 +822,10 @@ where
|
||||
E::Observers: Serialize + ObserversTuple<S::Input, S>,
|
||||
for<'a> E::Observers: Deserialize<'a>,
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State + HasExecutions + HasMetadata + HasLastReportTime + HasImported,
|
||||
Z: EvaluatorObservers<Self, E::Observers, State = S>
|
||||
+ ExecutionProcessor<Self, E::Observers, State = S>,
|
||||
S: State + HasExecutions + HasMetadata + HasLastReportTime + HasImported + HasCorpus,
|
||||
S::Corpus: Corpus<Input = S::Input>,
|
||||
Z: ExecutionProcessor<Self, <S::Corpus as Corpus>::Input, E::Observers, S>
|
||||
+ EvaluatorObservers<E, Self, <S::Corpus as Corpus>::Input, S>,
|
||||
{
|
||||
}
|
||||
|
||||
@ -858,7 +861,6 @@ where
|
||||
}
|
||||
|
||||
/// A manager that can restart on the fly, storing states in-between (in `on_restart`)
|
||||
#[cfg(feature = "std")]
|
||||
#[derive(Debug)]
|
||||
pub struct TcpRestartingEventManager<EMH, S, SP>
|
||||
where
|
||||
@ -875,7 +877,6 @@ where
|
||||
save_state: bool,
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<EMH, S, SP> UsesState for TcpRestartingEventManager<EMH, S, SP>
|
||||
where
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
@ -885,7 +886,6 @@ where
|
||||
type State = S;
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<EMH, S, SP> ProgressReporter for TcpRestartingEventManager<EMH, S, SP>
|
||||
where
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
@ -894,7 +894,6 @@ where
|
||||
{
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<EMH, S, SP> EventFirer for TcpRestartingEventManager<EMH, S, SP>
|
||||
where
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
@ -920,7 +919,6 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<EMH, S, SP> EventRestarter for TcpRestartingEventManager<EMH, S, SP>
|
||||
where
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
@ -959,17 +957,17 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<E, EMH, S, SP, Z> EventProcessor<E, Z> for TcpRestartingEventManager<EMH, S, SP>
|
||||
where
|
||||
E: HasObservers + Executor<TcpEventManager<EMH, S>, Z, State = S>,
|
||||
for<'a> E::Observers: Deserialize<'a>,
|
||||
E::Observers: ObserversTuple<S::Input, S> + Serialize,
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State + HasExecutions + HasMetadata + HasImported,
|
||||
S: State + HasExecutions + HasMetadata + HasImported + HasCorpus,
|
||||
S::Corpus: Corpus<Input = S::Input>,
|
||||
SP: ShMemProvider + 'static,
|
||||
Z: EvaluatorObservers<TcpEventManager<EMH, S>, E::Observers, State = S>
|
||||
+ ExecutionProcessor<TcpEventManager<EMH, S>, E::Observers>, //CE: CustomEvent<I>,
|
||||
Z: ExecutionProcessor<TcpEventManager<EMH, S>, <S::Corpus as Corpus>::Input, E::Observers, S>
|
||||
+ EvaluatorObservers<E, TcpEventManager<EMH, S>, <S::Corpus as Corpus>::Input, S>,
|
||||
{
|
||||
fn process(&mut self, fuzzer: &mut Z, state: &mut S, executor: &mut E) -> Result<usize, Error> {
|
||||
self.tcp_mgr.process(fuzzer, state, executor)
|
||||
@ -980,21 +978,20 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<E, EMH, S, SP, Z> EventManager<E, Z> for TcpRestartingEventManager<EMH, S, SP>
|
||||
where
|
||||
E: HasObservers + Executor<TcpEventManager<EMH, S>, Z, State = S>,
|
||||
E::Observers: ObserversTuple<S::Input, S> + Serialize,
|
||||
for<'a> E::Observers: Deserialize<'a>,
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
S: State + HasExecutions + HasMetadata + HasLastReportTime + HasImported,
|
||||
S: State + HasExecutions + HasMetadata + HasLastReportTime + HasImported + HasCorpus,
|
||||
S::Corpus: Corpus<Input = S::Input>,
|
||||
SP: ShMemProvider + 'static,
|
||||
Z: EvaluatorObservers<TcpEventManager<EMH, S>, E::Observers, State = S>
|
||||
+ ExecutionProcessor<TcpEventManager<EMH, S>, E::Observers>, //CE: CustomEvent<I>,
|
||||
Z: ExecutionProcessor<TcpEventManager<EMH, S>, <S::Corpus as Corpus>::Input, E::Observers, S>
|
||||
+ EvaluatorObservers<E, TcpEventManager<EMH, S>, <S::Corpus as Corpus>::Input, S>,
|
||||
{
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<EMH, S, SP> HasEventManagerId for TcpRestartingEventManager<EMH, S, SP>
|
||||
where
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
@ -1012,7 +1009,6 @@ const _ENV_FUZZER_RECEIVER: &str = "_AFL_ENV_FUZZER_RECEIVER";
|
||||
/// The tcp (2 way) connection from a fuzzer to the broker (broadcasting all other fuzzer messages)
|
||||
const _ENV_FUZZER_BROKER_CLIENT_INITIAL: &str = "_AFL_ENV_FUZZER_BROKER_CLIENT";
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<EMH, S, SP> TcpRestartingEventManager<EMH, S, SP>
|
||||
where
|
||||
EMH: EventManagerHooksTuple<S>,
|
||||
@ -1054,7 +1050,6 @@ where
|
||||
}
|
||||
|
||||
/// The kind of manager we're creating right now
|
||||
#[cfg(feature = "std")]
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub enum TcpManagerKind {
|
||||
/// Any kind will do
|
||||
@ -1072,7 +1067,6 @@ pub enum TcpManagerKind {
|
||||
///
|
||||
/// The [`TcpRestartingEventManager`] is a combination of restarter and runner, that can be used on systems with and without `fork` support.
|
||||
/// The restarter will spawn a new process each time the child crashes or timeouts.
|
||||
#[cfg(feature = "std")]
|
||||
#[allow(clippy::type_complexity)]
|
||||
pub fn setup_restarting_mgr_tcp<MT, S>(
|
||||
monitor: MT,
|
||||
@ -1087,7 +1081,8 @@ pub fn setup_restarting_mgr_tcp<MT, S>(
|
||||
>
|
||||
where
|
||||
MT: Monitor + Clone,
|
||||
S: State + HasExecutions + HasMetadata + HasImported,
|
||||
S: State + HasExecutions + HasMetadata + HasImported + HasCorpus,
|
||||
S::Corpus: Corpus<Input = S::Input>,
|
||||
{
|
||||
TcpRestartingMgr::builder()
|
||||
.shmem_provider(StdShMemProvider::new()?)
|
||||
@ -1104,7 +1099,6 @@ where
|
||||
/// The [`TcpRestartingMgr`] is a combination of a
|
||||
/// `restarter` and `runner`, that can be used on systems both with and without `fork` support. The
|
||||
/// `restarter` will start a new process each time the child crashes or times out.
|
||||
#[cfg(feature = "std")]
|
||||
#[allow(clippy::default_trait_access, clippy::ignored_unit_patterns)]
|
||||
#[derive(TypedBuilder, Debug)]
|
||||
pub struct TcpRestartingMgr<EMH, MT, S, SP>
|
||||
@ -1148,13 +1142,13 @@ where
|
||||
phantom_data: PhantomData<S>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[allow(clippy::type_complexity, clippy::too_many_lines)]
|
||||
impl<EMH, MT, S, SP> TcpRestartingMgr<EMH, MT, S, SP>
|
||||
where
|
||||
EMH: EventManagerHooksTuple<S> + Copy + Clone,
|
||||
SP: ShMemProvider,
|
||||
S: State + HasExecutions + HasMetadata + HasImported,
|
||||
S: State + HasExecutions + HasMetadata + HasImported + HasCorpus,
|
||||
S::Corpus: Corpus<Input = S::Input>,
|
||||
MT: Monitor + Clone,
|
||||
{
|
||||
/// Launch the restarting manager
|
||||
|
@ -26,7 +26,6 @@ impl<A, B> CombinedExecutor<A, B> {
|
||||
A: Executor<EM, Z>,
|
||||
B: Executor<EM, Z, State = <Self as UsesState>::State>,
|
||||
EM: UsesState<State = <Self as UsesState>::State>,
|
||||
Z: UsesState<State = <Self as UsesState>::State>,
|
||||
{
|
||||
Self { primary, secondary }
|
||||
}
|
||||
@ -48,7 +47,6 @@ where
|
||||
B: Executor<EM, Z, State = <Self as UsesState>::State>,
|
||||
Self::State: HasExecutions,
|
||||
EM: UsesState<State = <Self as UsesState>::State>,
|
||||
Z: UsesState<State = <Self as UsesState>::State>,
|
||||
{
|
||||
fn run_target(
|
||||
&mut self,
|
||||
|
@ -396,7 +396,6 @@ where
|
||||
S: State + HasExecutions + UsesInput,
|
||||
T: CommandConfigurator<S::Input> + Debug,
|
||||
OT: Debug + MatchName + ObserversTuple<S::Input, S>,
|
||||
Z: UsesState<State = S>,
|
||||
{
|
||||
fn run_target(
|
||||
&mut self,
|
||||
@ -433,7 +432,6 @@ where
|
||||
S: State + HasExecutions + UsesInput,
|
||||
T: CommandConfigurator<S::Input, Pid> + Debug,
|
||||
OT: Debug + MatchName + ObserversTuple<S::Input, S>,
|
||||
Z: UsesState<State = S>,
|
||||
HT: ExecutorHooksTuple<S>,
|
||||
{
|
||||
/// Linux specific low level implementation, to directly handle `fork`, `exec` and use linux
|
||||
@ -793,7 +791,6 @@ impl CommandExecutorBuilder {
|
||||
/// fn make_executor<EM, Z>() -> impl Executor<EM, Z>
|
||||
/// where
|
||||
/// EM: UsesState,
|
||||
/// Z: UsesState<State = EM::State>,
|
||||
/// EM::State: UsesInput<Input = BytesInput> + HasExecutions,
|
||||
/// {
|
||||
/// MyExecutor.into_executor(())
|
||||
|
@ -74,7 +74,6 @@ where
|
||||
<B as HasObservers>::Observers:
|
||||
ObserversTuple<<<A as UsesState>::State as UsesInput>::Input, <A as UsesState>::State>,
|
||||
DOT: DifferentialObserversTuple<A::Observers, B::Observers, A::Input, A::State> + MatchName,
|
||||
Z: UsesState<State = <Self as UsesState>::State>,
|
||||
{
|
||||
fn run_target(
|
||||
&mut self,
|
||||
|
@ -1588,7 +1588,6 @@ where
|
||||
S: State + HasExecutions,
|
||||
TC: TargetBytesConverter<Input = S::Input>,
|
||||
EM: UsesState<State = S>,
|
||||
Z: UsesState<State = S>,
|
||||
{
|
||||
#[inline]
|
||||
fn run_target(
|
||||
|
@ -236,7 +236,7 @@ where
|
||||
EM: EventFirer<State = E::State> + EventRestarter<State = E::State>,
|
||||
OF: Feedback<EM, E::Input, E::Observers, E::State>,
|
||||
E::State: HasExecutions + HasSolutions + HasCorpus,
|
||||
Z: HasObjective<Objective = OF, State = E::State>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
<<E as UsesState>::State as HasSolutions>::Solutions: Corpus<Input = E::Input>, //delete me
|
||||
<<<E as UsesState>::State as HasCorpus>::Corpus as Corpus>::Input: Clone, //delete me
|
||||
{
|
||||
@ -279,7 +279,7 @@ where
|
||||
EM: EventFirer<State = E::State> + EventRestarter<State = E::State>,
|
||||
OF: Feedback<EM, E::Input, E::Observers, E::State>,
|
||||
E::State: State + HasExecutions + HasSolutions + HasCorpus,
|
||||
Z: HasObjective<Objective = OF, State = E::State>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
<<E as UsesState>::State as HasSolutions>::Solutions: Corpus<Input = E::Input>, //delete me
|
||||
<<<E as UsesState>::State as HasCorpus>::Corpus as Corpus>::Input: Clone, //delete me
|
||||
{
|
||||
@ -336,7 +336,7 @@ where
|
||||
EM: EventFirer<State = E::State> + EventRestarter<State = E::State>,
|
||||
OF: Feedback<EM, E::Input, E::Observers, E::State>,
|
||||
E::State: HasExecutions + HasSolutions + HasCorpus,
|
||||
Z: HasObjective<Objective = OF, State = E::State>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
{
|
||||
#[cfg_attr(miri, allow(unused_variables))]
|
||||
let ret = Self {
|
||||
|
@ -84,7 +84,7 @@ pub mod unix_signal_handler {
|
||||
EM: EventFirer<State = E::State> + EventRestarter<State = E::State>,
|
||||
OF: Feedback<EM, E::Input, E::Observers, E::State>,
|
||||
E::State: HasExecutions + HasSolutions + HasCorpus,
|
||||
Z: HasObjective<Objective = OF, State = E::State>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
<<E as UsesState>::State as HasSolutions>::Solutions: Corpus<Input = E::Input>, //delete me
|
||||
<<<E as UsesState>::State as HasCorpus>::Corpus as Corpus>::Input: Clone, //delete me
|
||||
{
|
||||
@ -134,7 +134,7 @@ pub mod unix_signal_handler {
|
||||
EM: EventFirer<State = E::State> + EventRestarter<State = E::State>,
|
||||
OF: Feedback<EM, E::Input, E::Observers, E::State>,
|
||||
E::State: HasExecutions + HasSolutions + HasCorpus,
|
||||
Z: HasObjective<Objective = OF, State = E::State>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
<<E as UsesState>::State as HasSolutions>::Solutions: Corpus<Input = E::Input>, //delete me
|
||||
<<<E as UsesState>::State as HasCorpus>::Corpus as Corpus>::Input: Clone, //delete me
|
||||
{
|
||||
@ -192,7 +192,7 @@ pub mod unix_signal_handler {
|
||||
EM: EventFirer<State = E::State> + EventRestarter<State = E::State>,
|
||||
OF: Feedback<EM, E::Input, E::Observers, E::State>,
|
||||
E::State: HasExecutions + HasSolutions + HasCorpus,
|
||||
Z: HasObjective<Objective = OF, State = E::State>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
<<E as UsesState>::State as HasSolutions>::Solutions: Corpus<Input = E::Input>, //delete me
|
||||
<<<E as UsesState>::State as HasCorpus>::Corpus as Corpus>::Input: Clone, //delete me
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ pub mod windows_asan_handler {
|
||||
OF: Feedback<EM, E::Input, E::Observers, E::State>,
|
||||
E::State: HasExecutions + HasSolutions + HasCorpus,
|
||||
E::Observers: ObserversTuple<<E::State as UsesInput>::Input, E::State>,
|
||||
Z: HasObjective<Objective = OF, State = E::State>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
<<E as UsesState>::State as HasSolutions>::Solutions: Corpus<Input = E::Input>, //delete me
|
||||
<<<E as UsesState>::State as HasCorpus>::Corpus as Corpus>::Input: Clone, //delete me
|
||||
{
|
||||
@ -190,7 +190,7 @@ pub mod windows_exception_handler {
|
||||
OF: Feedback<EM, E::Input, E::Observers, E::State>,
|
||||
E::State: HasExecutions + HasSolutions + HasCorpus,
|
||||
E::Observers: ObserversTuple<<E::State as UsesInput>::Input, E::State>,
|
||||
Z: HasObjective<Objective = OF, State = E::State>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
<<E as UsesState>::State as HasSolutions>::Solutions: Corpus<Input = E::Input>, //delete me
|
||||
<<<E as UsesState>::State as HasCorpus>::Corpus as Corpus>::Input: Clone, //delete me
|
||||
{
|
||||
@ -253,7 +253,7 @@ pub mod windows_exception_handler {
|
||||
EM: EventFirer<State = E::State> + EventRestarter<State = E::State>,
|
||||
OF: Feedback<EM, E::Input, E::Observers, E::State>,
|
||||
E::State: State + HasExecutions + HasSolutions + HasCorpus,
|
||||
Z: HasObjective<Objective = OF, State = E::State>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
<<E as UsesState>::State as HasSolutions>::Solutions: Corpus<Input = E::Input>, //delete me
|
||||
<<<E as UsesState>::State as HasCorpus>::Corpus as Corpus>::Input: Clone, //delete me
|
||||
{
|
||||
@ -326,7 +326,7 @@ pub mod windows_exception_handler {
|
||||
EM: EventFirer<State = E::State> + EventRestarter<State = E::State>,
|
||||
OF: Feedback<EM, E::Input, E::Observers, E::State>,
|
||||
E::State: HasExecutions + HasSolutions + HasCorpus,
|
||||
Z: HasObjective<Objective = OF, State = E::State>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
<<E as UsesState>::State as HasSolutions>::Solutions: Corpus<Input = E::Input>, //delete me
|
||||
<<<E as UsesState>::State as HasCorpus>::Corpus as Corpus>::Input: Clone, //delete me
|
||||
{
|
||||
|
@ -161,7 +161,7 @@ where
|
||||
EM: EventFirer<State = S> + EventRestarter,
|
||||
OF: Feedback<EM, E::Input, E::Observers, S>,
|
||||
S: State,
|
||||
Z: HasObjective<Objective = OF, State = S>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
<<E as UsesState>::State as HasSolutions>::Solutions: Corpus<Input = E::Input>, //delete me
|
||||
<<<E as UsesState>::State as HasCorpus>::Corpus as Corpus>::Input: Clone, //delete me
|
||||
{
|
||||
@ -191,7 +191,7 @@ where
|
||||
EM: EventFirer<State = S> + EventRestarter,
|
||||
OF: Feedback<EM, E::Input, E::Observers, S>,
|
||||
S: State,
|
||||
Z: HasObjective<Objective = OF, State = S>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
<<E as UsesState>::State as HasSolutions>::Solutions: Corpus<Input = E::Input>, //delete me
|
||||
<<<E as UsesState>::State as HasCorpus>::Corpus as Corpus>::Input: Clone, //delete me
|
||||
{
|
||||
@ -224,7 +224,7 @@ where
|
||||
EM: EventFirer<State = S> + EventRestarter,
|
||||
OF: Feedback<EM, E::Input, E::Observers, S>,
|
||||
S: State,
|
||||
Z: HasObjective<Objective = OF, State = S>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
<<E as UsesState>::State as HasSolutions>::Solutions: Corpus<Input = E::Input>, //delete me
|
||||
<<<E as UsesState>::State as HasCorpus>::Corpus as Corpus>::Input: Clone, //delete me
|
||||
{
|
||||
|
@ -106,7 +106,6 @@ where
|
||||
HT: ExecutorHooksTuple<S>,
|
||||
OT: ObserversTuple<S::Input, S>,
|
||||
S: State + HasExecutions,
|
||||
Z: UsesState<State = S>,
|
||||
{
|
||||
fn run_target(
|
||||
&mut self,
|
||||
@ -173,7 +172,7 @@ where
|
||||
EM: EventFirer<State = S> + EventRestarter,
|
||||
OF: Feedback<EM, S::Input, OT, S>,
|
||||
S: State,
|
||||
Z: HasObjective<Objective = OF, State = S>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
{
|
||||
Self::with_timeout_generic(
|
||||
tuple_list!(),
|
||||
@ -201,7 +200,7 @@ where
|
||||
EM: EventFirer<State = S> + EventRestarter,
|
||||
OF: Feedback<EM, S::Input, OT, S>,
|
||||
S: State,
|
||||
Z: HasObjective<Objective = OF, State = S>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
<S as HasSolutions>::Solutions: Corpus<Input = S::Input>, //delete me
|
||||
<<S as HasCorpus>::Corpus as Corpus>::Input: Clone, //delete me
|
||||
{
|
||||
@ -242,7 +241,7 @@ where
|
||||
EM: EventFirer<State = S> + EventRestarter,
|
||||
OF: Feedback<EM, S::Input, OT, S>,
|
||||
S: State,
|
||||
Z: HasObjective<Objective = OF, State = S>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
<S as HasSolutions>::Solutions: Corpus<Input = S::Input>, //delete me
|
||||
<<S as HasCorpus>::Corpus as Corpus>::Input: Clone, //delete me
|
||||
{
|
||||
@ -287,7 +286,7 @@ where
|
||||
EM: EventFirer<State = S> + EventRestarter,
|
||||
OF: Feedback<EM, S::Input, OT, S>,
|
||||
S: State,
|
||||
Z: HasObjective<Objective = OF, State = S>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
{
|
||||
Self::with_timeout_generic(
|
||||
user_hooks,
|
||||
@ -316,7 +315,7 @@ where
|
||||
EM: EventFirer<State = S> + EventRestarter,
|
||||
OF: Feedback<EM, S::Input, OT, S>,
|
||||
S: State,
|
||||
Z: HasObjective<Objective = OF, State = S>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
<S as HasSolutions>::Solutions: Corpus<Input = S::Input>, //delete me
|
||||
<<S as HasCorpus>::Corpus as Corpus>::Input: Clone, //delete me
|
||||
{
|
||||
@ -353,7 +352,7 @@ where
|
||||
EM: EventFirer<State = S> + EventRestarter,
|
||||
OF: Feedback<EM, S::Input, OT, S>,
|
||||
S: State,
|
||||
Z: HasObjective<Objective = OF, State = S>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
<S as HasSolutions>::Solutions: Corpus<Input = S::Input>, //delete me
|
||||
<<S as HasCorpus>::Corpus as Corpus>::Input: Clone, //delete me
|
||||
{
|
||||
@ -442,7 +441,7 @@ pub fn run_observers_and_save_state<E, EM, OF, Z>(
|
||||
EM: EventFirer<State = E::State> + EventRestarter<State = E::State>,
|
||||
OF: Feedback<EM, E::Input, E::Observers, E::State>,
|
||||
E::State: HasExecutions + HasSolutions + HasCorpus + HasCurrentTestcase,
|
||||
Z: HasObjective<Objective = OF, State = E::State>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
<<E as UsesState>::State as HasSolutions>::Solutions: Corpus<Input = E::Input>, //delete me
|
||||
{
|
||||
let mut observers = executor.observers_mut();
|
||||
@ -503,9 +502,9 @@ where
|
||||
EM: EventFirer<State = E::State> + EventRestarter<State = E::State>,
|
||||
OF: Feedback<EM, E::Input, E::Observers, E::State>,
|
||||
E::State: HasExecutions + HasSolutions + HasCorpus + HasCurrentTestcase,
|
||||
Z: HasObjective<Objective = OF, State = E::State>
|
||||
+ HasScheduler<State = E::State>
|
||||
+ ExecutionProcessor<EM, E::Observers>,
|
||||
Z: HasObjective<Objective = OF>
|
||||
+ HasScheduler<E::Input, E::State>
|
||||
+ ExecutionProcessor<EM, E::Input, E::Observers, E::State>,
|
||||
<<E as UsesState>::State as HasSolutions>::Solutions: Corpus<Input = E::Input>, //delete me
|
||||
{
|
||||
let data = &raw mut GLOBAL_STATE;
|
||||
@ -533,7 +532,7 @@ where
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use libafl_bolts::tuples::tuple_list;
|
||||
use libafl_bolts::{rands::XkcdRand, tuples::tuple_list};
|
||||
|
||||
use crate::{
|
||||
corpus::InMemoryCorpus,
|
||||
@ -542,7 +541,7 @@ mod tests {
|
||||
feedbacks::CrashFeedback,
|
||||
inputs::{NopInput, UsesInput},
|
||||
schedulers::RandScheduler,
|
||||
state::StdState,
|
||||
state::{NopState, StdState},
|
||||
StdFuzzer,
|
||||
};
|
||||
|
||||
@ -554,16 +553,16 @@ mod tests {
|
||||
#[allow(clippy::let_unit_value)]
|
||||
fn test_inmem_exec() {
|
||||
let mut harness = |_buf: &NopInput| ExitKind::Ok;
|
||||
let rand = libafl_bolts::rands::XkcdRand::new();
|
||||
let rand = XkcdRand::new();
|
||||
let corpus = InMemoryCorpus::<NopInput>::new();
|
||||
let solutions = InMemoryCorpus::new();
|
||||
let mut objective = CrashFeedback::new();
|
||||
let mut feedback = tuple_list!();
|
||||
let sche = RandScheduler::new();
|
||||
let sche: RandScheduler<NopState<NopInput>> = RandScheduler::new();
|
||||
let mut mgr = NopEventManager::new();
|
||||
let mut state =
|
||||
StdState::new(rand, corpus, solutions, &mut feedback, &mut objective).unwrap();
|
||||
let mut fuzzer = StdFuzzer::<_, _, _, _>::new(sche, feedback, objective);
|
||||
let mut fuzzer = StdFuzzer::<_, _, _>::new(sche, feedback, objective);
|
||||
|
||||
let mut in_process_executor = InProcessExecutor::new(
|
||||
&mut harness,
|
||||
|
@ -98,7 +98,6 @@ where
|
||||
HT: ExecutorHooksTuple<S>,
|
||||
OT: ObserversTuple<S::Input, S>,
|
||||
S: State + HasExecutions,
|
||||
Z: UsesState<State = S>,
|
||||
{
|
||||
fn run_target(
|
||||
&mut self,
|
||||
@ -165,7 +164,7 @@ where
|
||||
EM: EventFirer<State = S> + EventRestarter,
|
||||
OF: Feedback<EM, S::Input, OT, S>,
|
||||
S: State,
|
||||
Z: HasObjective<Objective = OF, State = S>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
{
|
||||
Self::with_timeout_generic(
|
||||
tuple_list!(),
|
||||
@ -195,7 +194,7 @@ where
|
||||
EM: EventFirer<State = S> + EventRestarter,
|
||||
OF: Feedback<EM, S::Input, OT, S>,
|
||||
S: State,
|
||||
Z: HasObjective<Objective = OF, State = S>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
<S as HasSolutions>::Solutions: Corpus<Input = S::Input>, //delete me
|
||||
<<S as HasCorpus>::Corpus as Corpus>::Input: Clone, //delete me
|
||||
{
|
||||
@ -238,7 +237,7 @@ where
|
||||
EM: EventFirer<State = S> + EventRestarter,
|
||||
OF: Feedback<EM, S::Input, OT, S>,
|
||||
S: State,
|
||||
Z: HasObjective<Objective = OF, State = S>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
<S as HasSolutions>::Solutions: Corpus<Input = S::Input>, //delete me
|
||||
<<S as HasCorpus>::Corpus as Corpus>::Input: Clone, //delete me
|
||||
{
|
||||
@ -303,7 +302,7 @@ where
|
||||
EM: EventFirer<State = S> + EventRestarter,
|
||||
OF: Feedback<EM, S::Input, OT, S>,
|
||||
S: State,
|
||||
Z: HasObjective<Objective = OF, State = S>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
{
|
||||
Self::with_timeout_generic(
|
||||
user_hooks,
|
||||
@ -334,7 +333,7 @@ where
|
||||
EM: EventFirer<State = S> + EventRestarter,
|
||||
OF: Feedback<EM, S::Input, OT, S>,
|
||||
S: State,
|
||||
Z: HasObjective<Objective = OF, State = S>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
<S as HasSolutions>::Solutions: Corpus<Input = S::Input>, //delete me
|
||||
<<S as HasCorpus>::Corpus as Corpus>::Input: Clone, //delete me
|
||||
{
|
||||
@ -373,7 +372,7 @@ where
|
||||
EM: EventFirer<State = S> + EventRestarter,
|
||||
OF: Feedback<EM, S::Input, OT, S>,
|
||||
S: State,
|
||||
Z: HasObjective<Objective = OF, State = S>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
<S as HasSolutions>::Solutions: Corpus<Input = S::Input>, //delete me
|
||||
<<S as HasCorpus>::Corpus as Corpus>::Input: Clone, //delete me
|
||||
{
|
||||
|
@ -121,7 +121,6 @@ where
|
||||
SP: ShMemProvider,
|
||||
HT: ExecutorHooksTuple<S>,
|
||||
EM: EventFirer<State = S> + EventRestarter<State = S>,
|
||||
Z: UsesState<State = S>,
|
||||
{
|
||||
pub(super) unsafe fn pre_run_target_child(
|
||||
&mut self,
|
||||
|
@ -55,7 +55,7 @@ where
|
||||
EM: EventFirer<State = S> + EventRestarter<State = S>,
|
||||
OF: Feedback<EM, S::Input, OT, S>,
|
||||
S: HasSolutions,
|
||||
Z: HasObjective<Objective = OF, State = S>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
{
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
/// The constructor for `InProcessForkExecutor`
|
||||
@ -93,7 +93,6 @@ where
|
||||
SP: ShMemProvider,
|
||||
HT: ExecutorHooksTuple<S>,
|
||||
EM: UsesState<State = S>,
|
||||
Z: UsesState<State = S>,
|
||||
{
|
||||
harness_fn: &'a mut H,
|
||||
inner: GenericInProcessForkExecutorInner<HT, OT, S, SP, EM, Z>,
|
||||
@ -107,7 +106,6 @@ where
|
||||
SP: ShMemProvider,
|
||||
HT: ExecutorHooksTuple<S> + Debug,
|
||||
EM: UsesState<State = S>,
|
||||
Z: UsesState<State = S>,
|
||||
{
|
||||
#[cfg(target_os = "linux")]
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
@ -135,7 +133,6 @@ where
|
||||
SP: ShMemProvider,
|
||||
HT: ExecutorHooksTuple<S>,
|
||||
EM: UsesState<State = S>,
|
||||
Z: UsesState<State = S>,
|
||||
{
|
||||
type State = S;
|
||||
}
|
||||
@ -149,7 +146,6 @@ where
|
||||
SP: ShMemProvider,
|
||||
HT: ExecutorHooksTuple<S>,
|
||||
EM: EventFirer<State = S> + EventRestarter<State = S>,
|
||||
Z: UsesState<State = S>,
|
||||
{
|
||||
#[allow(unreachable_code)]
|
||||
#[inline]
|
||||
@ -191,7 +187,7 @@ where
|
||||
EM: EventFirer<State = S> + EventRestarter<State = S>,
|
||||
OF: Feedback<EM, S::Input, OT, S>,
|
||||
S: State + HasSolutions,
|
||||
Z: HasObjective<Objective = OF, State = S>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
{
|
||||
/// Creates a new [`GenericInProcessForkExecutor`] with custom hooks
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
@ -242,7 +238,6 @@ where
|
||||
OT: ObserversTuple<S::Input, S>,
|
||||
SP: ShMemProvider,
|
||||
EM: UsesState<State = S>,
|
||||
Z: UsesState<State = S>,
|
||||
{
|
||||
type Observers = OT;
|
||||
#[inline]
|
||||
|
@ -124,7 +124,7 @@ where
|
||||
OT: ObserversTuple<S::Input, S> + Debug,
|
||||
S: State + HasExecutions,
|
||||
SP: ShMemProvider,
|
||||
Z: HasObjective<Objective = OF, State = S>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
{
|
||||
#[allow(unreachable_code)]
|
||||
#[inline]
|
||||
|
@ -120,7 +120,6 @@ pub trait HasObservers {
|
||||
pub trait Executor<EM, Z>: UsesState
|
||||
where
|
||||
EM: UsesState<State = Self::State>,
|
||||
Z: UsesState<State = Self::State>,
|
||||
{
|
||||
/// Instruct the target about the input and run
|
||||
fn run_target(
|
||||
@ -209,7 +208,6 @@ mod test {
|
||||
EM: UsesState<State = S>,
|
||||
S: State + HasExecutions,
|
||||
S::Input: HasTargetBytes,
|
||||
Z: UsesState<State = S>,
|
||||
{
|
||||
fn run_target(
|
||||
&mut self,
|
||||
|
@ -68,7 +68,6 @@ where
|
||||
E: Executor<EM, Z> + HasObservers,
|
||||
SOT: ObserversTuple<Self::Input, Self::State>,
|
||||
EM: UsesState<State = Self::State>,
|
||||
Z: UsesState<State = Self::State>,
|
||||
{
|
||||
fn run_target(
|
||||
&mut self,
|
||||
|
@ -23,7 +23,6 @@ impl<E, EM, OT, Z> Executor<EM, Z> for WithObservers<E, OT>
|
||||
where
|
||||
E: Executor<EM, Z>,
|
||||
EM: UsesState<State = Self::State>,
|
||||
Z: UsesState<State = Self::State>,
|
||||
{
|
||||
fn run_target(
|
||||
&mut self,
|
||||
|
@ -1,10 +1,10 @@
|
||||
//! The `Fuzzer` is the main struct for a fuzz campaign.
|
||||
|
||||
use alloc::{string::ToString, vec::Vec};
|
||||
use core::{fmt::Debug, marker::PhantomData, time::Duration};
|
||||
use core::{fmt::Debug, time::Duration};
|
||||
|
||||
use libafl_bolts::current_time;
|
||||
use serde::{de::DeserializeOwned, Serialize};
|
||||
use libafl_bolts::{current_time, tuples::MatchName};
|
||||
use serde::Serialize;
|
||||
|
||||
#[cfg(feature = "introspection")]
|
||||
use crate::monitors::PerfFeature;
|
||||
@ -13,7 +13,7 @@ use crate::{
|
||||
events::{Event, EventConfig, EventFirer, EventProcessor, ProgressReporter},
|
||||
executors::{Executor, ExitKind, HasObservers},
|
||||
feedbacks::Feedback,
|
||||
inputs::UsesInput,
|
||||
inputs::{Input, UsesInput},
|
||||
mark_feature_time,
|
||||
observers::ObserversTuple,
|
||||
schedulers::Scheduler,
|
||||
@ -21,7 +21,7 @@ use crate::{
|
||||
start_timer,
|
||||
state::{
|
||||
HasCorpus, HasCurrentTestcase, HasExecutions, HasLastFoundTime, HasLastReportTime,
|
||||
HasSolutions, State, Stoppable, UsesState,
|
||||
HasSolutions, MaybeHasClientPerfMonitor, State, UsesState,
|
||||
},
|
||||
Error, HasMetadata,
|
||||
};
|
||||
@ -30,12 +30,9 @@ use crate::{
|
||||
pub(crate) const STATS_TIMEOUT_DEFAULT: Duration = Duration::from_secs(15);
|
||||
|
||||
/// Holds a scheduler
|
||||
pub trait HasScheduler: UsesState
|
||||
where
|
||||
Self::State: HasCorpus,
|
||||
{
|
||||
pub trait HasScheduler<I, S> {
|
||||
/// The [`Scheduler`] for this fuzzer
|
||||
type Scheduler: Scheduler<Self::Input, Self::State>;
|
||||
type Scheduler: Scheduler<I, S>;
|
||||
|
||||
/// The scheduler
|
||||
fn scheduler(&self) -> &Self::Scheduler;
|
||||
@ -45,7 +42,7 @@ where
|
||||
}
|
||||
|
||||
/// Holds an feedback
|
||||
pub trait HasFeedback: UsesState {
|
||||
pub trait HasFeedback {
|
||||
/// The feedback type
|
||||
type Feedback;
|
||||
|
||||
@ -57,7 +54,7 @@ pub trait HasFeedback: UsesState {
|
||||
}
|
||||
|
||||
/// Holds an objective feedback
|
||||
pub trait HasObjective: UsesState {
|
||||
pub trait HasObjective {
|
||||
/// The type of the [`Feedback`] used to find objectives for this fuzzer
|
||||
type Objective;
|
||||
|
||||
@ -69,104 +66,87 @@ pub trait HasObjective: UsesState {
|
||||
}
|
||||
|
||||
/// Evaluates if an input is interesting using the feedback
|
||||
pub trait ExecutionProcessor<EM, OT>: UsesState {
|
||||
pub trait ExecutionProcessor<EM, I, OT, S> {
|
||||
/// Check the outcome of the execution, find if it is worth for corpus or objectives
|
||||
fn check_results(
|
||||
&mut self,
|
||||
state: &mut Self::State,
|
||||
state: &mut S,
|
||||
manager: &mut EM,
|
||||
input: &<Self::State as UsesInput>::Input,
|
||||
input: &I,
|
||||
observers: &OT,
|
||||
exit_kind: &ExitKind,
|
||||
) -> Result<ExecuteInputResult, Error>
|
||||
where
|
||||
EM: EventFirer<State = Self::State>,
|
||||
OT: ObserversTuple<<Self as UsesInput>::Input, Self::State>;
|
||||
) -> Result<ExecuteInputResult, Error>;
|
||||
|
||||
/// Process `ExecuteInputResult`. Add to corpus, solution or ignore
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
fn process_execution(
|
||||
&mut self,
|
||||
state: &mut Self::State,
|
||||
state: &mut S,
|
||||
manager: &mut EM,
|
||||
input: &<Self::State as UsesInput>::Input,
|
||||
input: &I,
|
||||
exec_res: &ExecuteInputResult,
|
||||
observers: &OT,
|
||||
) -> Result<Option<CorpusId>, Error>
|
||||
where
|
||||
EM: EventFirer<State = Self::State>,
|
||||
OT: ObserversTuple<<Self as UsesInput>::Input, Self::State>;
|
||||
) -> Result<Option<CorpusId>, Error>;
|
||||
|
||||
/// serialize and send event via manager
|
||||
fn serialize_and_dispatch(
|
||||
&mut self,
|
||||
state: &mut Self::State,
|
||||
state: &mut S,
|
||||
manager: &mut EM,
|
||||
input: <Self::State as UsesInput>::Input,
|
||||
input: I,
|
||||
exec_res: &ExecuteInputResult,
|
||||
observers: &OT,
|
||||
exit_kind: &ExitKind,
|
||||
) -> Result<(), Error>
|
||||
where
|
||||
EM: EventFirer<State = Self::State>,
|
||||
OT: ObserversTuple<<Self as UsesInput>::Input, Self::State> + Serialize;
|
||||
) -> Result<(), Error>;
|
||||
|
||||
/// send event via manager
|
||||
fn dispatch_event(
|
||||
&mut self,
|
||||
state: &mut Self::State,
|
||||
state: &mut S,
|
||||
manager: &mut EM,
|
||||
input: <Self::State as UsesInput>::Input,
|
||||
input: I,
|
||||
exec_res: &ExecuteInputResult,
|
||||
obs_buf: Option<Vec<u8>>,
|
||||
exit_kind: &ExitKind,
|
||||
) -> Result<(), Error>
|
||||
where
|
||||
EM: EventFirer<State = Self::State>;
|
||||
) -> Result<(), Error>;
|
||||
|
||||
/// Evaluate if a set of observation channels has an interesting state
|
||||
fn evaluate_execution(
|
||||
&mut self,
|
||||
state: &mut Self::State,
|
||||
state: &mut S,
|
||||
manager: &mut EM,
|
||||
input: <Self::State as UsesInput>::Input,
|
||||
input: I,
|
||||
observers: &OT,
|
||||
exit_kind: &ExitKind,
|
||||
send_events: bool,
|
||||
) -> Result<(ExecuteInputResult, Option<CorpusId>), Error>
|
||||
where
|
||||
EM: EventFirer<State = Self::State>,
|
||||
OT: ObserversTuple<<Self as UsesInput>::Input, Self::State> + Serialize;
|
||||
) -> Result<(ExecuteInputResult, Option<CorpusId>), Error>;
|
||||
}
|
||||
|
||||
/// Evaluates an input modifying the state of the fuzzer
|
||||
pub trait EvaluatorObservers<EM, OT>: UsesState + Sized {
|
||||
pub trait EvaluatorObservers<E, EM, I, S> {
|
||||
/// Runs the input and triggers observers and feedback,
|
||||
/// returns if is interesting an (option) the index of the new
|
||||
/// [`crate::corpus::Testcase`] in the [`crate::corpus::Corpus`]
|
||||
fn evaluate_input_with_observers<E>(
|
||||
fn evaluate_input_with_observers(
|
||||
&mut self,
|
||||
state: &mut Self::State,
|
||||
state: &mut S,
|
||||
executor: &mut E,
|
||||
manager: &mut EM,
|
||||
input: <Self::State as UsesInput>::Input,
|
||||
input: I,
|
||||
send_events: bool,
|
||||
) -> Result<(ExecuteInputResult, Option<CorpusId>), Error>
|
||||
where
|
||||
E: Executor<EM, Self, State = Self::State> + HasObservers<Observers = OT>,
|
||||
EM: EventFirer<State = Self::State>;
|
||||
) -> Result<(ExecuteInputResult, Option<CorpusId>), Error>;
|
||||
}
|
||||
|
||||
/// Evaluate an input modifying the state of the fuzzer
|
||||
pub trait Evaluator<E, EM>: UsesState {
|
||||
pub trait Evaluator<E, EM, I, S> {
|
||||
/// Runs the input and triggers observers and feedback,
|
||||
/// returns if is interesting an (option) the index of the new [`crate::corpus::Testcase`] in the corpus
|
||||
fn evaluate_input(
|
||||
&mut self,
|
||||
state: &mut Self::State,
|
||||
state: &mut S,
|
||||
executor: &mut E,
|
||||
manager: &mut EM,
|
||||
input: <Self::State as UsesInput>::Input,
|
||||
input: I,
|
||||
) -> Result<(ExecuteInputResult, Option<CorpusId>), Error> {
|
||||
self.evaluate_input_events(state, executor, manager, input, true)
|
||||
}
|
||||
@ -176,10 +156,10 @@ pub trait Evaluator<E, EM>: UsesState {
|
||||
/// This version has a boolean to decide if send events to the manager.
|
||||
fn evaluate_input_events(
|
||||
&mut self,
|
||||
state: &mut Self::State,
|
||||
state: &mut S,
|
||||
executor: &mut E,
|
||||
manager: &mut EM,
|
||||
input: <Self::State as UsesInput>::Input,
|
||||
input: I,
|
||||
send_events: bool,
|
||||
) -> Result<(ExecuteInputResult, Option<CorpusId>), Error>;
|
||||
|
||||
@ -189,10 +169,10 @@ pub trait Evaluator<E, EM>: UsesState {
|
||||
/// Usually, you want to use [`Evaluator::evaluate_input`], unless you know what you are doing.
|
||||
fn add_input(
|
||||
&mut self,
|
||||
state: &mut Self::State,
|
||||
state: &mut S,
|
||||
executor: &mut E,
|
||||
manager: &mut EM,
|
||||
input: <Self::State as UsesInput>::Input,
|
||||
input: I,
|
||||
) -> Result<CorpusId, Error>;
|
||||
|
||||
/// Adds the input to the corpus as disabled a input.
|
||||
@ -200,21 +180,11 @@ pub trait Evaluator<E, EM>: UsesState {
|
||||
/// Disabled testcases are only used for splicing
|
||||
/// Returns the `index` of the new testcase in the corpus.
|
||||
/// Usually, you want to use [`Evaluator::evaluate_input`], unless you know what you are doing.
|
||||
fn add_disabled_input(
|
||||
&mut self,
|
||||
state: &mut Self::State,
|
||||
input: <Self::State as UsesInput>::Input,
|
||||
) -> Result<CorpusId, Error>;
|
||||
fn add_disabled_input(&mut self, state: &mut S, input: I) -> Result<CorpusId, Error>;
|
||||
}
|
||||
|
||||
/// The main fuzzer trait.
|
||||
pub trait Fuzzer<E, EM, ST>: Sized + UsesState
|
||||
where
|
||||
Self::State: HasMetadata + HasExecutions + HasLastReportTime + Stoppable,
|
||||
E: UsesState<State = Self::State>,
|
||||
EM: ProgressReporter<State = Self::State>,
|
||||
ST: StagesTuple<E, EM, Self::State, Self>,
|
||||
{
|
||||
pub trait Fuzzer<E, EM, S, ST> {
|
||||
/// Fuzz for a single iteration.
|
||||
/// Returns the index of the last fuzzed corpus item.
|
||||
/// (Note: An iteration represents a complete run of every stage.
|
||||
@ -228,7 +198,7 @@ where
|
||||
&mut self,
|
||||
stages: &mut ST,
|
||||
executor: &mut E,
|
||||
state: &mut Self::State,
|
||||
state: &mut S,
|
||||
manager: &mut EM,
|
||||
) -> Result<CorpusId, Error>;
|
||||
|
||||
@ -237,16 +207,9 @@ where
|
||||
&mut self,
|
||||
stages: &mut ST,
|
||||
executor: &mut E,
|
||||
state: &mut Self::State,
|
||||
state: &mut S,
|
||||
manager: &mut EM,
|
||||
) -> Result<(), Error> {
|
||||
let monitor_timeout = STATS_TIMEOUT_DEFAULT;
|
||||
loop {
|
||||
manager.maybe_report_progress(state, monitor_timeout)?;
|
||||
|
||||
self.fuzz_one(stages, executor, state, manager)?;
|
||||
}
|
||||
}
|
||||
) -> Result<(), Error>;
|
||||
|
||||
/// Fuzz for n iterations.
|
||||
/// Returns the index of the last fuzzed corpus item.
|
||||
@ -261,33 +224,10 @@ where
|
||||
&mut self,
|
||||
stages: &mut ST,
|
||||
executor: &mut E,
|
||||
state: &mut Self::State,
|
||||
state: &mut S,
|
||||
manager: &mut EM,
|
||||
iters: u64,
|
||||
) -> Result<CorpusId, Error> {
|
||||
if iters == 0 {
|
||||
return Err(Error::illegal_argument(
|
||||
"Cannot fuzz for 0 iterations!".to_string(),
|
||||
));
|
||||
}
|
||||
|
||||
let mut ret = None;
|
||||
let monitor_timeout = STATS_TIMEOUT_DEFAULT;
|
||||
|
||||
for _ in 0..iters {
|
||||
manager.maybe_report_progress(state, monitor_timeout)?;
|
||||
ret = Some(self.fuzz_one(stages, executor, state, manager)?);
|
||||
}
|
||||
|
||||
manager.report_progress(state)?;
|
||||
|
||||
// If we would assume the fuzzer loop will always exit after this, we could do this here:
|
||||
// manager.on_restart(state)?;
|
||||
// But as the state may grow to a few megabytes,
|
||||
// for now we won't, and the user has to do it (unless we find a way to do this on `Drop`).
|
||||
|
||||
Ok(ret.unwrap())
|
||||
}
|
||||
) -> Result<CorpusId, Error>;
|
||||
}
|
||||
|
||||
/// The corpus this input should be added to
|
||||
@ -303,24 +243,16 @@ pub enum ExecuteInputResult {
|
||||
|
||||
/// Your default fuzzer instance, for everyday use.
|
||||
#[derive(Debug)]
|
||||
pub struct StdFuzzer<CS, F, OF, S> {
|
||||
pub struct StdFuzzer<CS, F, OF> {
|
||||
scheduler: CS,
|
||||
feedback: F,
|
||||
objective: OF,
|
||||
phantom: PhantomData<S>,
|
||||
}
|
||||
|
||||
impl<CS, F, OF, S> UsesState for StdFuzzer<CS, F, OF, S>
|
||||
impl<CS, F, OF, S> HasScheduler<<S::Corpus as Corpus>::Input, S> for StdFuzzer<CS, F, OF>
|
||||
where
|
||||
S: State,
|
||||
{
|
||||
type State = S;
|
||||
}
|
||||
|
||||
impl<CS, F, OF, S> HasScheduler for StdFuzzer<CS, F, OF, S>
|
||||
where
|
||||
S: State + HasCorpus,
|
||||
CS: Scheduler<S::Input, S>,
|
||||
S: HasCorpus,
|
||||
CS: Scheduler<<S::Corpus as Corpus>::Input, S>,
|
||||
{
|
||||
type Scheduler = CS;
|
||||
|
||||
@ -333,10 +265,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<CS, F, OF, S> HasFeedback for StdFuzzer<CS, F, OF, S>
|
||||
where
|
||||
S: State,
|
||||
{
|
||||
impl<CS, F, OF> HasFeedback for StdFuzzer<CS, F, OF> {
|
||||
type Feedback = F;
|
||||
|
||||
fn feedback(&self) -> &Self::Feedback {
|
||||
@ -348,10 +277,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<CS, F, OF, S> HasObjective for StdFuzzer<CS, F, OF, S>
|
||||
where
|
||||
S: State,
|
||||
{
|
||||
impl<CS, F, OF> HasObjective for StdFuzzer<CS, F, OF> {
|
||||
type Objective = OF;
|
||||
|
||||
fn objective(&self) -> &OF {
|
||||
@ -363,27 +289,30 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<CS, EM, F, OF, OT, S> ExecutionProcessor<EM, OT> for StdFuzzer<CS, F, OF, S>
|
||||
impl<CS, EM, F, OF, OT, S> ExecutionProcessor<EM, <S::Corpus as Corpus>::Input, OT, S>
|
||||
for StdFuzzer<CS, F, OF>
|
||||
where
|
||||
CS: Scheduler<S::Input, S>,
|
||||
F: Feedback<EM, S::Input, OT, S>,
|
||||
OF: Feedback<EM, S::Input, OT, S>,
|
||||
S: HasCorpus + HasSolutions + HasExecutions + HasCorpus + HasCurrentCorpusId + State,
|
||||
S::Corpus: Corpus<Input = S::Input>, //delete me
|
||||
S::Solutions: Corpus<Input = S::Input>, //delete me
|
||||
CS: Scheduler<<S::Corpus as Corpus>::Input, S>,
|
||||
EM: EventFirer<State = S>,
|
||||
S: HasCorpus
|
||||
+ MaybeHasClientPerfMonitor
|
||||
+ UsesInput<Input = <S::Corpus as Corpus>::Input>
|
||||
+ HasCurrentTestcase
|
||||
+ HasSolutions,
|
||||
F: Feedback<EM, <S::Corpus as Corpus>::Input, OT, S>,
|
||||
OF: Feedback<EM, <S::Corpus as Corpus>::Input, OT, S>,
|
||||
OT: ObserversTuple<<S::Corpus as Corpus>::Input, S> + Serialize,
|
||||
<S::Corpus as Corpus>::Input: Input,
|
||||
S::Solutions: Corpus<Input = <S::Corpus as Corpus>::Input>,
|
||||
{
|
||||
fn check_results(
|
||||
&mut self,
|
||||
state: &mut S,
|
||||
manager: &mut EM,
|
||||
input: &S::Input,
|
||||
input: &<S::Corpus as Corpus>::Input,
|
||||
observers: &OT,
|
||||
exit_kind: &ExitKind,
|
||||
) -> Result<ExecuteInputResult, Error>
|
||||
where
|
||||
EM: EventFirer<State = Self::State>,
|
||||
OT: ObserversTuple<Self::Input, Self::State>,
|
||||
{
|
||||
) -> Result<ExecuteInputResult, Error> {
|
||||
let mut res = ExecuteInputResult::None;
|
||||
|
||||
#[cfg(not(feature = "introspection"))]
|
||||
@ -418,17 +347,13 @@ where
|
||||
|
||||
fn evaluate_execution(
|
||||
&mut self,
|
||||
state: &mut Self::State,
|
||||
state: &mut S,
|
||||
manager: &mut EM,
|
||||
input: <Self::State as UsesInput>::Input,
|
||||
input: <S::Corpus as Corpus>::Input,
|
||||
observers: &OT,
|
||||
exit_kind: &ExitKind,
|
||||
send_events: bool,
|
||||
) -> Result<(ExecuteInputResult, Option<CorpusId>), Error>
|
||||
where
|
||||
EM: EventFirer<State = Self::State>,
|
||||
OT: ObserversTuple<Self::Input, Self::State> + Serialize,
|
||||
{
|
||||
) -> Result<(ExecuteInputResult, Option<CorpusId>), Error> {
|
||||
let exec_res = self.check_results(state, manager, &input, observers, exit_kind)?;
|
||||
let corpus_id = self.process_execution(state, manager, &input, &exec_res, observers)?;
|
||||
if send_events {
|
||||
@ -439,17 +364,13 @@ where
|
||||
|
||||
fn serialize_and_dispatch(
|
||||
&mut self,
|
||||
state: &mut Self::State,
|
||||
state: &mut S,
|
||||
manager: &mut EM,
|
||||
input: <Self::State as UsesInput>::Input,
|
||||
input: <S::Corpus as Corpus>::Input,
|
||||
exec_res: &ExecuteInputResult,
|
||||
observers: &OT,
|
||||
exit_kind: &ExitKind,
|
||||
) -> Result<(), Error>
|
||||
where
|
||||
EM: EventFirer<State = Self::State>,
|
||||
OT: ObserversTuple<Self::Input, Self::State> + Serialize,
|
||||
{
|
||||
) -> Result<(), Error> {
|
||||
// Now send off the event
|
||||
let observers_buf = match exec_res {
|
||||
ExecuteInputResult::Corpus => {
|
||||
@ -473,16 +394,13 @@ where
|
||||
|
||||
fn dispatch_event(
|
||||
&mut self,
|
||||
state: &mut Self::State,
|
||||
state: &mut S,
|
||||
manager: &mut EM,
|
||||
input: <Self::State as UsesInput>::Input,
|
||||
input: <S::Corpus as Corpus>::Input,
|
||||
exec_res: &ExecuteInputResult,
|
||||
observers_buf: Option<Vec<u8>>,
|
||||
exit_kind: &ExitKind,
|
||||
) -> Result<(), Error>
|
||||
where
|
||||
EM: EventFirer<State = Self::State>,
|
||||
{
|
||||
) -> Result<(), Error> {
|
||||
// Now send off the event
|
||||
match exec_res {
|
||||
ExecuteInputResult::Corpus => {
|
||||
@ -522,16 +440,12 @@ where
|
||||
/// Evaluate if a set of observation channels has an interesting state
|
||||
fn process_execution(
|
||||
&mut self,
|
||||
state: &mut Self::State,
|
||||
state: &mut S,
|
||||
manager: &mut EM,
|
||||
input: &S::Input,
|
||||
input: &<S::Corpus as Corpus>::Input,
|
||||
exec_res: &ExecuteInputResult,
|
||||
observers: &OT,
|
||||
) -> Result<Option<CorpusId>, Error>
|
||||
where
|
||||
EM: EventFirer<State = Self::State>,
|
||||
OT: ObserversTuple<Self::Input, Self::State>,
|
||||
{
|
||||
) -> Result<Option<CorpusId>, Error> {
|
||||
match exec_res {
|
||||
ExecuteInputResult::None => {
|
||||
self.feedback_mut().discard_metadata(state, input)?;
|
||||
@ -577,30 +491,34 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<CS, EM, F, OF, OT, S> EvaluatorObservers<EM, OT> for StdFuzzer<CS, F, OF, S>
|
||||
impl<CS, E, EM, F, OF, S> EvaluatorObservers<E, EM, <S::Corpus as Corpus>::Input, S>
|
||||
for StdFuzzer<CS, F, OF>
|
||||
where
|
||||
CS: Scheduler<S::Input, S>,
|
||||
OT: ObserversTuple<S::Input, S> + Serialize + DeserializeOwned,
|
||||
F: Feedback<EM, S::Input, OT, S>,
|
||||
OF: Feedback<EM, S::Input, OT, S>,
|
||||
S: HasCorpus + HasSolutions + HasExecutions + State,
|
||||
S::Corpus: Corpus<Input = S::Input>, //delete me
|
||||
S::Solutions: Corpus<Input = S::Input>, //delete me
|
||||
CS: Scheduler<<S::Corpus as Corpus>::Input, S>,
|
||||
E: HasObservers + Executor<EM, Self, State = S>,
|
||||
E::Observers: MatchName + ObserversTuple<<S::Corpus as Corpus>::Input, S> + Serialize,
|
||||
EM: EventFirer<State = S>,
|
||||
F: Feedback<EM, <S::Corpus as Corpus>::Input, E::Observers, S>,
|
||||
OF: Feedback<EM, <S::Corpus as Corpus>::Input, E::Observers, S>,
|
||||
S: HasCorpus
|
||||
+ HasSolutions
|
||||
+ MaybeHasClientPerfMonitor
|
||||
+ HasCurrentTestcase
|
||||
+ UsesInput<Input = <S::Corpus as Corpus>::Input>
|
||||
+ HasExecutions,
|
||||
<S::Corpus as Corpus>::Input: Input,
|
||||
S::Solutions: Corpus<Input = <S::Corpus as Corpus>::Input>,
|
||||
{
|
||||
/// Process one input, adding to the respective corpora if needed and firing the right events
|
||||
#[inline]
|
||||
fn evaluate_input_with_observers<E>(
|
||||
fn evaluate_input_with_observers(
|
||||
&mut self,
|
||||
state: &mut S,
|
||||
executor: &mut E,
|
||||
manager: &mut EM,
|
||||
input: S::Input,
|
||||
input: <S::Corpus as Corpus>::Input,
|
||||
send_events: bool,
|
||||
) -> Result<(ExecuteInputResult, Option<CorpusId>), Error>
|
||||
where
|
||||
E: Executor<EM, Self, State = S> + HasObservers<Observers = OT>,
|
||||
EM: EventFirer<State = S>,
|
||||
{
|
||||
) -> Result<(ExecuteInputResult, Option<CorpusId>), Error> {
|
||||
let exit_kind = self.execute_input(state, executor, manager, &input)?;
|
||||
let observers = executor.observers();
|
||||
|
||||
@ -610,34 +528,40 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<CS, E, EM, F, OF, S> Evaluator<E, EM> for StdFuzzer<CS, F, OF, S>
|
||||
impl<CS, E, EM, F, OF, S> Evaluator<E, EM, <S::Corpus as Corpus>::Input, S> for StdFuzzer<CS, F, OF>
|
||||
where
|
||||
CS: Scheduler<S::Input, S>,
|
||||
CS: Scheduler<<S::Corpus as Corpus>::Input, S>,
|
||||
E: HasObservers + Executor<EM, Self, State = S>,
|
||||
E::Observers: ObserversTuple<S::Input, S> + Serialize + DeserializeOwned,
|
||||
E::Observers: MatchName + ObserversTuple<<S::Corpus as Corpus>::Input, S> + Serialize,
|
||||
EM: EventFirer<State = S>,
|
||||
F: Feedback<EM, S::Input, E::Observers, S>,
|
||||
OF: Feedback<EM, S::Input, E::Observers, S>,
|
||||
S: HasCorpus + HasSolutions + HasExecutions + HasLastFoundTime + State,
|
||||
S::Corpus: Corpus<Input = S::Input>, //delete me
|
||||
S::Solutions: Corpus<Input = S::Input>, //delete me
|
||||
F: Feedback<EM, <S::Corpus as Corpus>::Input, E::Observers, S>,
|
||||
OF: Feedback<EM, <S::Corpus as Corpus>::Input, E::Observers, S>,
|
||||
S: HasCorpus
|
||||
+ HasSolutions
|
||||
+ MaybeHasClientPerfMonitor
|
||||
+ HasCurrentTestcase
|
||||
+ HasLastFoundTime
|
||||
+ HasExecutions
|
||||
+ UsesInput<Input = <S::Corpus as Corpus>::Input>,
|
||||
<S::Corpus as Corpus>::Input: Input,
|
||||
S::Solutions: Corpus<Input = <S::Corpus as Corpus>::Input>,
|
||||
{
|
||||
/// Process one input, adding to the respective corpora if needed and firing the right events
|
||||
#[inline]
|
||||
fn evaluate_input_events(
|
||||
&mut self,
|
||||
state: &mut Self::State,
|
||||
state: &mut S,
|
||||
executor: &mut E,
|
||||
manager: &mut EM,
|
||||
input: <Self::State as UsesInput>::Input,
|
||||
input: <S::Corpus as Corpus>::Input,
|
||||
send_events: bool,
|
||||
) -> Result<(ExecuteInputResult, Option<CorpusId>), Error> {
|
||||
self.evaluate_input_with_observers(state, executor, manager, input, send_events)
|
||||
}
|
||||
fn add_disabled_input(
|
||||
&mut self,
|
||||
state: &mut Self::State,
|
||||
input: <Self::State as UsesInput>::Input,
|
||||
state: &mut S,
|
||||
input: <S::Corpus as Corpus>::Input,
|
||||
) -> Result<CorpusId, Error> {
|
||||
let mut testcase = Testcase::from(input.clone());
|
||||
testcase.set_disabled(true);
|
||||
@ -648,10 +572,10 @@ where
|
||||
/// Adds an input, even if it's not considered `interesting` by any of the executors
|
||||
fn add_input(
|
||||
&mut self,
|
||||
state: &mut Self::State,
|
||||
state: &mut S,
|
||||
executor: &mut E,
|
||||
manager: &mut EM,
|
||||
input: <Self::State as UsesInput>::Input,
|
||||
input: <S::Corpus as Corpus>::Input,
|
||||
) -> Result<CorpusId, Error> {
|
||||
*state.last_found_time_mut() = current_time();
|
||||
|
||||
@ -744,7 +668,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<CS, E, EM, F, OF, S, ST> Fuzzer<E, EM, ST> for StdFuzzer<CS, F, OF, S>
|
||||
impl<CS, E, EM, F, OF, S, ST> Fuzzer<E, EM, S, ST> for StdFuzzer<CS, F, OF>
|
||||
where
|
||||
CS: Scheduler<S::Input, S>,
|
||||
E: UsesState<State = S>,
|
||||
@ -763,7 +687,7 @@ where
|
||||
&mut self,
|
||||
stages: &mut ST,
|
||||
executor: &mut E,
|
||||
state: &mut Self::State,
|
||||
state: &mut S,
|
||||
manager: &mut EM,
|
||||
) -> Result<CorpusId, Error> {
|
||||
// Init timer for scheduler
|
||||
@ -819,77 +743,89 @@ where
|
||||
|
||||
Ok(id)
|
||||
}
|
||||
|
||||
fn fuzz_loop(
|
||||
&mut self,
|
||||
stages: &mut ST,
|
||||
executor: &mut E,
|
||||
state: &mut S,
|
||||
manager: &mut EM,
|
||||
) -> Result<(), Error> {
|
||||
let monitor_timeout = STATS_TIMEOUT_DEFAULT;
|
||||
loop {
|
||||
manager.maybe_report_progress(state, monitor_timeout)?;
|
||||
|
||||
self.fuzz_one(stages, executor, state, manager)?;
|
||||
}
|
||||
}
|
||||
|
||||
impl<CS, F, OF, S> StdFuzzer<CS, F, OF, S>
|
||||
where
|
||||
CS: Scheduler<S::Input, S>,
|
||||
S: UsesInput + HasExecutions + HasCorpus + State,
|
||||
{
|
||||
fn fuzz_loop_for(
|
||||
&mut self,
|
||||
stages: &mut ST,
|
||||
executor: &mut E,
|
||||
state: &mut S,
|
||||
manager: &mut EM,
|
||||
iters: u64,
|
||||
) -> Result<CorpusId, Error> {
|
||||
if iters == 0 {
|
||||
return Err(Error::illegal_argument(
|
||||
"Cannot fuzz for 0 iterations!".to_string(),
|
||||
));
|
||||
}
|
||||
|
||||
let mut ret = None;
|
||||
let monitor_timeout = STATS_TIMEOUT_DEFAULT;
|
||||
|
||||
for _ in 0..iters {
|
||||
manager.maybe_report_progress(state, monitor_timeout)?;
|
||||
ret = Some(self.fuzz_one(stages, executor, state, manager)?);
|
||||
}
|
||||
|
||||
manager.report_progress(state)?;
|
||||
|
||||
// If we would assume the fuzzer loop will always exit after this, we could do this here:
|
||||
// manager.on_restart(state)?;
|
||||
// But as the state may grow to a few megabytes,
|
||||
// for now we won't, and the user has to do it (unless we find a way to do this on `Drop`).
|
||||
|
||||
Ok(ret.unwrap())
|
||||
}
|
||||
}
|
||||
|
||||
impl<CS, F, OF> StdFuzzer<CS, F, OF> {
|
||||
/// Create a new `StdFuzzer` with standard behavior.
|
||||
pub fn new(scheduler: CS, feedback: F, objective: OF) -> Self {
|
||||
Self {
|
||||
scheduler,
|
||||
feedback,
|
||||
objective,
|
||||
phantom: PhantomData,
|
||||
}
|
||||
}
|
||||
|
||||
/// Runs the input and triggers observers
|
||||
pub fn execute_input<E, EM>(
|
||||
&mut self,
|
||||
state: &mut <Self as UsesState>::State,
|
||||
executor: &mut E,
|
||||
event_mgr: &mut EM,
|
||||
input: &<<Self as UsesState>::State as UsesInput>::Input,
|
||||
) -> Result<ExitKind, Error>
|
||||
where
|
||||
E: Executor<EM, Self, State = <Self as UsesState>::State> + HasObservers,
|
||||
E::Observers: ObserversTuple<<Self as UsesInput>::Input, <Self as UsesState>::State>,
|
||||
EM: UsesState<State = <Self as UsesState>::State>,
|
||||
{
|
||||
start_timer!(state);
|
||||
executor.observers_mut().pre_exec_all(state, input)?;
|
||||
mark_feature_time!(state, PerfFeature::PreExecObservers);
|
||||
|
||||
start_timer!(state);
|
||||
let exit_kind = executor.run_target(self, state, event_mgr, input)?;
|
||||
mark_feature_time!(state, PerfFeature::TargetExecution);
|
||||
|
||||
start_timer!(state);
|
||||
executor
|
||||
.observers_mut()
|
||||
.post_exec_all(state, input, &exit_kind)?;
|
||||
mark_feature_time!(state, PerfFeature::PostExecObservers);
|
||||
|
||||
Ok(exit_kind)
|
||||
}
|
||||
}
|
||||
|
||||
/// Structs with this trait will execute an input
|
||||
pub trait ExecutesInput<E, EM>: UsesState
|
||||
where
|
||||
E: UsesState<State = Self::State>,
|
||||
EM: UsesState<State = Self::State>,
|
||||
{
|
||||
pub trait ExecutesInput<E, EM, I, S> {
|
||||
/// Runs the input and triggers observers and feedback
|
||||
fn execute_input(
|
||||
&mut self,
|
||||
state: &mut Self::State,
|
||||
state: &mut S,
|
||||
executor: &mut E,
|
||||
event_mgr: &mut EM,
|
||||
input: &<Self::State as UsesInput>::Input,
|
||||
input: &I,
|
||||
) -> Result<ExitKind, Error>;
|
||||
}
|
||||
|
||||
impl<CS, E, EM, F, OF, S> ExecutesInput<E, EM> for StdFuzzer<CS, F, OF, S>
|
||||
impl<CS, E, EM, F, OF, S> ExecutesInput<E, EM, <S::Corpus as Corpus>::Input, S>
|
||||
for StdFuzzer<CS, F, OF>
|
||||
where
|
||||
CS: Scheduler<S::Input, S>,
|
||||
CS: Scheduler<<S::Corpus as Corpus>::Input, S>,
|
||||
E: Executor<EM, Self, State = S> + HasObservers,
|
||||
E::Observers: ObserversTuple<<Self as UsesInput>::Input, <Self as UsesState>::State>,
|
||||
EM: UsesState<State = Self::State>,
|
||||
S: UsesInput + HasExecutions + HasCorpus + State,
|
||||
E::Observers: ObserversTuple<<S::Corpus as Corpus>::Input, S>,
|
||||
EM: UsesState<State = S>,
|
||||
S: UsesInput<Input = <S::Corpus as Corpus>::Input>
|
||||
+ HasExecutions
|
||||
+ HasCorpus
|
||||
+ MaybeHasClientPerfMonitor,
|
||||
{
|
||||
/// Runs the input and triggers observers and feedback
|
||||
fn execute_input(
|
||||
@ -897,7 +833,7 @@ where
|
||||
state: &mut S,
|
||||
executor: &mut E,
|
||||
event_mgr: &mut EM,
|
||||
input: &S::Input,
|
||||
input: &<S::Corpus as Corpus>::Input,
|
||||
) -> Result<ExitKind, Error> {
|
||||
start_timer!(state);
|
||||
executor.observers_mut().pre_exec_all(state, input)?;
|
||||
@ -919,39 +855,28 @@ where
|
||||
|
||||
/// A [`NopFuzzer`] that does nothing
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct NopFuzzer<S> {
|
||||
phantom: PhantomData<S>,
|
||||
}
|
||||
pub struct NopFuzzer {}
|
||||
|
||||
impl<S> NopFuzzer<S> {
|
||||
impl NopFuzzer {
|
||||
/// Creates a new [`NopFuzzer`]
|
||||
#[must_use]
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
phantom: PhantomData,
|
||||
}
|
||||
Self {}
|
||||
}
|
||||
}
|
||||
|
||||
impl<S> Default for NopFuzzer<S> {
|
||||
impl Default for NopFuzzer {
|
||||
fn default() -> Self {
|
||||
Self::new()
|
||||
}
|
||||
}
|
||||
|
||||
impl<S> UsesState for NopFuzzer<S>
|
||||
where
|
||||
S: State,
|
||||
{
|
||||
type State = S;
|
||||
}
|
||||
|
||||
impl<ST, E, EM> Fuzzer<E, EM, ST> for NopFuzzer<E::State>
|
||||
impl<E, EM, S, ST> Fuzzer<E, EM, S, ST> for NopFuzzer
|
||||
where
|
||||
E: UsesState,
|
||||
EM: ProgressReporter<State = Self::State> + EventProcessor<E, Self>,
|
||||
ST: StagesTuple<E, EM, Self::State, Self>,
|
||||
Self::State: HasMetadata + HasExecutions + HasLastReportTime + HasCurrentStageId,
|
||||
EM: ProgressReporter<State = S> + EventProcessor<E, Self>,
|
||||
ST: StagesTuple<E, EM, S, Self>,
|
||||
S: HasMetadata + HasExecutions + HasLastReportTime + HasCurrentStageId + UsesInput,
|
||||
{
|
||||
fn fuzz_one(
|
||||
&mut self,
|
||||
@ -962,4 +887,25 @@ where
|
||||
) -> Result<CorpusId, Error> {
|
||||
unimplemented!("NopFuzzer cannot fuzz");
|
||||
}
|
||||
|
||||
fn fuzz_loop(
|
||||
&mut self,
|
||||
_stages: &mut ST,
|
||||
_executor: &mut E,
|
||||
_state: &mut S,
|
||||
_manager: &mut EM,
|
||||
) -> Result<(), Error> {
|
||||
unimplemented!("NopFuzzer cannot fuzz");
|
||||
}
|
||||
|
||||
fn fuzz_loop_for(
|
||||
&mut self,
|
||||
_stages: &mut ST,
|
||||
_executor: &mut E,
|
||||
_state: &mut S,
|
||||
_manager: &mut EM,
|
||||
_iters: u64,
|
||||
) -> Result<CorpusId, Error> {
|
||||
unimplemented!("NopFuzzer cannot fuzz");
|
||||
}
|
||||
}
|
||||
|
@ -239,7 +239,7 @@ impl<C, E, EM, O, S, Z> Stage<E, EM, S, Z> for AflStatsStage<C, E, EM, O, S, Z>
|
||||
where
|
||||
E: HasObservers,
|
||||
EM: EventFirer,
|
||||
Z: HasScheduler<State = S>,
|
||||
Z: HasScheduler<<S::Corpus as Corpus>::Input, S>,
|
||||
S: HasImported
|
||||
+ HasCorpus
|
||||
+ HasMetadata
|
||||
@ -252,7 +252,7 @@ where
|
||||
E::Observers: MatchNameRef,
|
||||
O: MapObserver,
|
||||
C: AsRef<O> + Named,
|
||||
<Z as HasScheduler>::Scheduler: HasQueueCycles,
|
||||
Z::Scheduler: HasQueueCycles,
|
||||
{
|
||||
#[allow(clippy::too_many_lines)]
|
||||
fn perform(
|
||||
|
@ -102,7 +102,7 @@ where
|
||||
+ HasCurrentTestcase
|
||||
+ HasCurrentCorpusId
|
||||
+ UsesInput<Input = <S::Corpus as Corpus>::Input>,
|
||||
Z: Evaluator<E, EM, State = S>,
|
||||
Z: Evaluator<E, EM, <S::Corpus as Corpus>::Input, S>,
|
||||
<S::Corpus as Corpus>::Input: Input,
|
||||
{
|
||||
#[inline]
|
||||
|
@ -92,7 +92,6 @@ where
|
||||
<S::Corpus as Corpus>::Input: HasMutatorBytes + Clone,
|
||||
O: MapObserver,
|
||||
C: AsRef<O> + Named,
|
||||
Z: UsesState<State = S>,
|
||||
{
|
||||
#[inline]
|
||||
#[allow(clippy::let_and_return)]
|
||||
@ -174,7 +173,6 @@ where
|
||||
+ HasCurrentTestcase
|
||||
+ UsesInput<Input = <S::Corpus as Corpus>::Input>,
|
||||
<S::Corpus as Corpus>::Input: HasMutatorBytes + Clone,
|
||||
Z: UsesState<State = S>,
|
||||
{
|
||||
#[inline]
|
||||
#[allow(clippy::let_and_return)]
|
||||
|
@ -60,7 +60,6 @@ where
|
||||
+ MaybeHasClientPerfMonitor
|
||||
+ UsesInput<Input = <S::Corpus as Corpus>::Input>,
|
||||
EM: UsesState<State = S>,
|
||||
Z: UsesState<State = S>,
|
||||
{
|
||||
#[inline]
|
||||
fn perform(
|
||||
@ -362,14 +361,6 @@ pub struct SimpleConcolicMutationalStage<Z> {
|
||||
phantom: PhantomData<Z>,
|
||||
}
|
||||
|
||||
#[cfg(feature = "concolic_mutation")]
|
||||
impl<Z> UsesState for SimpleConcolicMutationalStage<Z>
|
||||
where
|
||||
Z: UsesState,
|
||||
{
|
||||
type State = Z::State;
|
||||
}
|
||||
|
||||
#[cfg(feature = "concolic_mutation")]
|
||||
/// The unique id for this stage
|
||||
static mut SIMPLE_CONCOLIC_MUTATIONAL_ID: usize = 0;
|
||||
@ -388,7 +379,7 @@ impl<Z> Named for SimpleConcolicMutationalStage<Z> {
|
||||
#[cfg(feature = "concolic_mutation")]
|
||||
impl<E, EM, S, Z> Stage<E, EM, S, Z> for SimpleConcolicMutationalStage<Z>
|
||||
where
|
||||
Z: Evaluator<E, EM, State = S>,
|
||||
Z: Evaluator<E, EM, <S::Corpus as Corpus>::Input, S>,
|
||||
<S::Corpus as Corpus>::Input: HasMutatorBytes + Clone,
|
||||
S: HasExecutions
|
||||
+ HasCorpus
|
||||
|
@ -76,7 +76,6 @@ where
|
||||
+ UsesInput<Input = BytesInput>,
|
||||
S::Corpus: Corpus<Input = BytesInput>,
|
||||
EM: UsesState<State = S>,
|
||||
Z: UsesState<State = S>,
|
||||
{
|
||||
#[inline]
|
||||
#[allow(clippy::too_many_lines)]
|
||||
@ -352,7 +351,6 @@ where
|
||||
+ UsesInput<Input = BytesInput>,
|
||||
OT: ObserversTuple<BytesInput, S>,
|
||||
EM: UsesState<State = S>,
|
||||
Z: UsesState<State = S>,
|
||||
{
|
||||
/// Create a new [`GeneralizationStage`].
|
||||
#[must_use]
|
||||
|
@ -31,7 +31,7 @@ impl<G, S, Z> GenStage<G, S, Z> {
|
||||
|
||||
impl<E, EM, G, S, Z> Stage<E, EM, S, Z> for GenStage<G, S, Z>
|
||||
where
|
||||
Z: Evaluator<E, EM, State = S>,
|
||||
Z: Evaluator<E, EM, <S::Corpus as Corpus>::Input, S>,
|
||||
S: HasCorpus + HasRand + UsesInput<Input = <S::Corpus as Corpus>::Input>,
|
||||
G: Generator<<S::Corpus as Corpus>::Input, S>,
|
||||
{
|
||||
|
@ -150,7 +150,7 @@ impl<E, EM, I, M, S, Z> Named for StdMutationalStage<E, EM, I, M, S, Z> {
|
||||
impl<E, EM, I, M, S, Z> Stage<E, EM, S, Z> for StdMutationalStage<E, EM, I, M, S, Z>
|
||||
where
|
||||
M: Mutator<I, S>,
|
||||
Z: Evaluator<E, EM, State = S>,
|
||||
Z: Evaluator<E, EM, <S::Corpus as Corpus>::Input, S>,
|
||||
S: HasCorpus
|
||||
+ HasRand
|
||||
+ HasMetadata
|
||||
@ -192,7 +192,7 @@ where
|
||||
impl<E, EM, M, S, Z> StdMutationalStage<E, EM, <S::Corpus as Corpus>::Input, M, S, Z>
|
||||
where
|
||||
M: Mutator<<S::Corpus as Corpus>::Input, S>,
|
||||
Z: Evaluator<E, EM, State = S>,
|
||||
Z: Evaluator<E, EM, <S::Corpus as Corpus>::Input, S>,
|
||||
S: HasCorpus + HasRand + HasCurrentCorpusId + UsesInput + MaybeHasClientPerfMonitor,
|
||||
<S::Corpus as Corpus>::Input: Input + Clone,
|
||||
S::Corpus: Corpus<Input = S::Input>,
|
||||
@ -213,7 +213,7 @@ where
|
||||
impl<E, EM, I, M, S, Z> StdMutationalStage<E, EM, I, M, S, Z>
|
||||
where
|
||||
M: Mutator<I, S>,
|
||||
Z: Evaluator<E, EM, State = S>,
|
||||
Z: Evaluator<E, EM, <S::Corpus as Corpus>::Input, S>,
|
||||
S: HasCorpus + HasRand + HasCurrentTestcase + MaybeHasClientPerfMonitor + UsesInput,
|
||||
I: MutatedTransform<<S::Corpus as Corpus>::Input, S> + Clone,
|
||||
<S::Corpus as Corpus>::Input: Input,
|
||||
@ -319,7 +319,7 @@ impl<E, EM, I, M, S, Z> Named for MultiMutationalStage<E, EM, I, M, S, Z> {
|
||||
impl<E, EM, I, M, S, Z> Stage<E, EM, S, Z> for MultiMutationalStage<E, EM, I, M, S, Z>
|
||||
where
|
||||
M: MultiMutator<I, S>,
|
||||
Z: Evaluator<E, EM, State = S>,
|
||||
Z: Evaluator<E, EM, <S::Corpus as Corpus>::Input, S>,
|
||||
S: HasCorpus + HasRand + HasNamedMetadata + HasCurrentTestcase + HasCurrentCorpusId + UsesInput,
|
||||
I: MutatedTransform<<S::Corpus as Corpus>::Input, S> + Clone,
|
||||
<S::Corpus as Corpus>::Input: Input,
|
||||
|
@ -93,7 +93,7 @@ where
|
||||
+ HasCurrentCorpusId
|
||||
+ MaybeHasClientPerfMonitor
|
||||
+ UsesInput<Input = <S::Corpus as Corpus>::Input>,
|
||||
Z: Evaluator<E, EM, State = S>,
|
||||
Z: Evaluator<E, EM, <S::Corpus as Corpus>::Input, S>,
|
||||
I: MutatedTransform<<S::Corpus as Corpus>::Input, S> + Clone + Input,
|
||||
<S::Corpus as Corpus>::Input: Input,
|
||||
{
|
||||
@ -134,7 +134,7 @@ where
|
||||
+ MaybeHasClientPerfMonitor
|
||||
+ UsesInput<Input = <S::Corpus as Corpus>::Input>,
|
||||
I: MutatedTransform<<S::Corpus as Corpus>::Input, S> + Clone + Input,
|
||||
Z: Evaluator<E, EM, State = S>,
|
||||
Z: Evaluator<E, EM, <S::Corpus as Corpus>::Input, S>,
|
||||
<S::Corpus as Corpus>::Input: Input,
|
||||
{
|
||||
/// Creates a new [`PowerMutationalStage`]
|
||||
|
@ -262,10 +262,10 @@ where
|
||||
EM: EventFirer<State = S> + EventRestarter + HasEventManagerId + ProgressReporter<State = S>,
|
||||
OT: ObserversTuple<<S::Corpus as Corpus>::Input, S>,
|
||||
PS: PushStage<EM, <S::Corpus as Corpus>::Input, OT, S, Z>,
|
||||
Z: ExecutesInput<E, EM, State = S>
|
||||
+ ExecutionProcessor<EM, OT>
|
||||
+ EvaluatorObservers<EM, OT>
|
||||
+ HasScheduler<Scheduler = CS>,
|
||||
Z: ExecutesInput<E, EM, <S::Corpus as Corpus>::Input, S>
|
||||
+ ExecutionProcessor<EM, <S::Corpus as Corpus>::Input, OT, S>
|
||||
+ EvaluatorObservers<E, EM, <S::Corpus as Corpus>::Input, OT>
|
||||
+ HasScheduler<<S::Corpus as Corpus>::Input, S>,
|
||||
{
|
||||
fn perform(
|
||||
&mut self,
|
||||
|
@ -80,7 +80,8 @@ impl<EM, M, OT, S, Z> PushStage<EM, <S::Corpus as Corpus>::Input, OT, S, Z>
|
||||
for StdMutationalPushStage<EM, M, OT, S, Z>
|
||||
where
|
||||
EM: EventFirer<State = S>,
|
||||
Z: HasScheduler<State = S> + ExecutionProcessor<EM, OT>,
|
||||
Z: HasScheduler<<S::Corpus as Corpus>::Input, S>
|
||||
+ ExecutionProcessor<EM, <S::Corpus as Corpus>::Input, OT, S>,
|
||||
S: HasCorpus
|
||||
+ UsesInput<Input = <S::Corpus as Corpus>::Input>
|
||||
+ HasRand
|
||||
@ -203,7 +204,8 @@ where
|
||||
OT: ObserversTuple<<S::Corpus as Corpus>::Input, S> + Serialize,
|
||||
M: Mutator<<S::Corpus as Corpus>::Input, S>,
|
||||
<S::Corpus as Corpus>::Input: Clone + Debug + Input,
|
||||
Z: HasScheduler<State = S> + ExecutionProcessor<EM, OT>,
|
||||
Z: HasScheduler<<S::Corpus as Corpus>::Input, S>
|
||||
+ ExecutionProcessor<EM, <S::Corpus as Corpus>::Input, OT, S>,
|
||||
{
|
||||
type Item = Result<<S::Corpus as Corpus>::Input, Error>;
|
||||
|
||||
@ -225,7 +227,8 @@ where
|
||||
OT: ObserversTuple<<S::Corpus as Corpus>::Input, S> + Serialize,
|
||||
M: Mutator<<S::Corpus as Corpus>::Input, S>,
|
||||
<S::Corpus as Corpus>::Input: Clone + Debug + Input,
|
||||
Z: HasScheduler<State = S> + ExecutionProcessor<EM, OT>,
|
||||
Z: HasScheduler<<S::Corpus as Corpus>::Input, S>
|
||||
+ ExecutionProcessor<EM, <S::Corpus as Corpus>::Input, OT, S>,
|
||||
{
|
||||
/// Creates a new default mutational stage
|
||||
#[must_use]
|
||||
|
@ -69,7 +69,7 @@ impl<CB, E, EM, S, Z> Named for SyncFromDiskStage<CB, E, EM, S, Z> {
|
||||
impl<CB, E, EM, S, Z> Stage<E, EM, S, Z> for SyncFromDiskStage<CB, E, EM, S, Z>
|
||||
where
|
||||
CB: FnMut(&mut Z, &mut S, &Path) -> Result<<S::Corpus as Corpus>::Input, Error>,
|
||||
Z: Evaluator<E, EM, State = S>,
|
||||
Z: Evaluator<E, EM, <S::Corpus as Corpus>::Input, S>,
|
||||
S: HasCorpus
|
||||
+ HasRand
|
||||
+ HasMetadata
|
||||
@ -167,20 +167,25 @@ impl<CB, E, EM, S, Z> SyncFromDiskStage<CB, E, EM, S, Z> {
|
||||
|
||||
/// Function type when the callback in `SyncFromDiskStage` is not a lambda
|
||||
pub type SyncFromDiskFunction<S, Z> =
|
||||
fn(&mut Z, &mut S, &Path) -> Result<<S as UsesInput>::Input, Error>;
|
||||
fn(&mut Z, &mut S, &Path) -> Result<<<S as HasCorpus>::Corpus as Corpus>::Input, Error>;
|
||||
|
||||
impl<E, EM, S, Z> SyncFromDiskStage<SyncFromDiskFunction<Z::State, Z>, E, EM, S, Z>
|
||||
impl<E, EM, S, Z> SyncFromDiskStage<SyncFromDiskFunction<S, Z>, E, EM, S, Z>
|
||||
where
|
||||
Z: Evaluator<E, EM>,
|
||||
S: HasCorpus,
|
||||
<S::Corpus as Corpus>::Input: Input,
|
||||
Z: Evaluator<E, EM, <S::Corpus as Corpus>::Input, S>,
|
||||
{
|
||||
/// Creates a new [`SyncFromDiskStage`] invoking `Input::from_file` to load inputs
|
||||
#[must_use]
|
||||
pub fn with_from_file(sync_dirs: Vec<PathBuf>, interval: Duration) -> Self {
|
||||
fn load_callback<S: UsesInput, Z>(
|
||||
fn load_callback<S: HasCorpus, Z>(
|
||||
_: &mut Z,
|
||||
_: &mut S,
|
||||
p: &Path,
|
||||
) -> Result<S::Input, Error> {
|
||||
) -> Result<<S::Corpus as Corpus>::Input, Error>
|
||||
where
|
||||
<S::Corpus as Corpus>::Input: Input,
|
||||
{
|
||||
Input::from_file(p)
|
||||
}
|
||||
Self {
|
||||
@ -240,7 +245,8 @@ where
|
||||
SP: ShMemProvider,
|
||||
E: HasObservers + Executor<EM, Z, State = S>,
|
||||
for<'a> E::Observers: Deserialize<'a>,
|
||||
Z: EvaluatorObservers<EM, E::Observers> + ExecutionProcessor<EM, E::Observers, State = S>,
|
||||
Z: EvaluatorObservers<E, EM, <S::Corpus as Corpus>::Input, S>
|
||||
+ ExecutionProcessor<EM, <S::Corpus as Corpus>::Input, E::Observers, S>,
|
||||
IC: InputConverter<From = <S::Corpus as Corpus>::Input, To = DI>,
|
||||
ICB: InputConverter<From = DI, To = <S::Corpus as Corpus>::Input>,
|
||||
DI: Input,
|
||||
|
@ -59,9 +59,9 @@ pub struct StdTMinMutationalStage<E, EM, F, FF, M, S, Z> {
|
||||
|
||||
impl<E, EM, F, FF, M, S, Z> Stage<E, EM, S, Z> for StdTMinMutationalStage<E, EM, F, FF, M, S, Z>
|
||||
where
|
||||
Z: HasScheduler<State = S>
|
||||
+ ExecutionProcessor<EM, E::Observers>
|
||||
+ ExecutesInput<E, EM>
|
||||
Z: HasScheduler<<S::Corpus as Corpus>::Input, S>
|
||||
+ ExecutionProcessor<EM, <S::Corpus as Corpus>::Input, E::Observers, S>
|
||||
+ ExecutesInput<E, EM, <S::Corpus as Corpus>::Input, S>
|
||||
+ HasFeedback,
|
||||
Z::Scheduler: RemovableScheduler<<S::Corpus as Corpus>::Input, S>,
|
||||
E: HasObservers + UsesState<State = S>,
|
||||
@ -94,7 +94,7 @@ where
|
||||
&mut self,
|
||||
fuzzer: &mut Z,
|
||||
executor: &mut E,
|
||||
state: &mut Z::State,
|
||||
state: &mut S,
|
||||
manager: &mut EM,
|
||||
) -> Result<(), Error> {
|
||||
self.perform_minification(fuzzer, executor, state, manager)?;
|
||||
@ -130,14 +130,14 @@ pub static TMIN_STAGE_NAME: &str = "tmin";
|
||||
|
||||
impl<E, EM, F, FF, M, S, Z> StdTMinMutationalStage<E, EM, F, FF, M, S, Z>
|
||||
where
|
||||
Z: HasScheduler<State = S>
|
||||
+ ExecutionProcessor<EM, E::Observers>
|
||||
+ ExecutesInput<E, EM>
|
||||
Z: HasScheduler<<S::Corpus as Corpus>::Input, S>
|
||||
+ ExecutionProcessor<EM, <S::Corpus as Corpus>::Input, E::Observers, S>
|
||||
+ ExecutesInput<E, EM, <S::Corpus as Corpus>::Input, S>
|
||||
+ HasFeedback,
|
||||
Z::Scheduler: RemovableScheduler<<S::Corpus as Corpus>::Input, S>,
|
||||
E: HasObservers + UsesState<State = Z::State>,
|
||||
E: HasObservers + UsesState<State = S>,
|
||||
E::Observers: ObserversTuple<<S::Corpus as Corpus>::Input, S> + Serialize,
|
||||
EM: EventFirer<State = Z::State>,
|
||||
EM: EventFirer<State = S>,
|
||||
FF: FeedbackFactory<F, E::Observers>,
|
||||
F: Feedback<EM, <S::Corpus as Corpus>::Input, E::Observers, S>,
|
||||
S: HasMetadata
|
||||
|
@ -42,7 +42,6 @@ where
|
||||
+ MaybeHasClientPerfMonitor
|
||||
+ UsesInput<Input = <S::Corpus as Corpus>::Input>,
|
||||
EM: UsesState<State = S>, //delete me
|
||||
Z: UsesState<State = S>, //delete me
|
||||
{
|
||||
#[allow(rustdoc::broken_intra_doc_links)]
|
||||
/// Perform tracing on the given `CorpusId`. Useful for if wrapping [`TracingStage`] with your
|
||||
@ -87,7 +86,6 @@ where
|
||||
+ MaybeHasClientPerfMonitor
|
||||
+ UsesInput<Input = <S::Corpus as Corpus>::Input>,
|
||||
EM: UsesState<State = S>,
|
||||
Z: UsesState<State = S>,
|
||||
<S::Corpus as Corpus>::Input: Input,
|
||||
{
|
||||
#[inline]
|
||||
@ -183,7 +181,6 @@ where
|
||||
+ MaybeHasClientPerfMonitor
|
||||
+ UsesInput<Input = <S::Corpus as Corpus>::Input>,
|
||||
EM: UsesState<State = S>,
|
||||
Z: UsesState<State = S>,
|
||||
{
|
||||
#[inline]
|
||||
fn perform(
|
||||
@ -232,11 +229,10 @@ where
|
||||
|
||||
impl<E, EM, SOT, S, Z> ShadowTracingStage<E, EM, SOT, S, Z>
|
||||
where
|
||||
E: Executor<EM, Z, State = Z::State> + HasObservers,
|
||||
S: HasExecutions + HasCorpus,
|
||||
E: Executor<EM, Z, State = S> + HasObservers,
|
||||
S: HasExecutions + HasCorpus + UsesInput,
|
||||
SOT: ObserversTuple<<S::Corpus as Corpus>::Input, S>,
|
||||
EM: UsesState<State = Z::State>,
|
||||
Z: UsesState,
|
||||
EM: UsesState<State = S>,
|
||||
{
|
||||
/// Creates a new default stage
|
||||
pub fn new(_executor: &mut ShadowExecutor<E, SOT>) -> Self {
|
||||
|
@ -164,7 +164,7 @@ pub struct TuneableMutationalStage<E, EM, I, M, S, Z> {
|
||||
impl<E, EM, I, M, S, Z> MutationalStage<S> for TuneableMutationalStage<E, EM, I, M, S, Z>
|
||||
where
|
||||
M: Mutator<I, S>,
|
||||
Z: Evaluator<E, EM>,
|
||||
Z: Evaluator<E, EM, <S::Corpus as Corpus>::Input, S>,
|
||||
S: HasCorpus + HasRand + HasNamedMetadata + HasMetadata + HasExecutions + HasCurrentTestcase,
|
||||
I: MutatedTransform<<S::Corpus as Corpus>::Input, S> + Clone,
|
||||
<S::Corpus as Corpus>::Input: Input,
|
||||
@ -196,7 +196,7 @@ where
|
||||
impl<E, EM, I, M, S, Z> Stage<E, EM, S, Z> for TuneableMutationalStage<E, EM, I, M, S, Z>
|
||||
where
|
||||
M: Mutator<I, S>,
|
||||
Z: Evaluator<E, EM, State = S>,
|
||||
Z: Evaluator<E, EM, <S::Corpus as Corpus>::Input, S>,
|
||||
S: HasCorpus
|
||||
+ HasRand
|
||||
+ HasNamedMetadata
|
||||
@ -237,7 +237,7 @@ where
|
||||
impl<E, EM, I, M, S, Z> TuneableMutationalStage<E, EM, I, M, S, Z>
|
||||
where
|
||||
M: Mutator<I, S>,
|
||||
Z: Evaluator<E, EM, State = S>,
|
||||
Z: Evaluator<E, EM, <S::Corpus as Corpus>::Input, S>,
|
||||
S: HasCorpus
|
||||
+ HasRand
|
||||
+ HasNamedMetadata
|
||||
@ -469,8 +469,8 @@ where
|
||||
|
||||
impl<E, EM, I, M, S, Z> TuneableMutationalStage<E, EM, I, M, S, Z>
|
||||
where
|
||||
M: Mutator<I, Z::State>,
|
||||
Z: Evaluator<E, EM>,
|
||||
M: Mutator<I, S>,
|
||||
Z: Evaluator<E, EM, <S::Corpus as Corpus>::Input, S>,
|
||||
S: HasCorpus + HasRand + HasNamedMetadata,
|
||||
{
|
||||
/// Creates a new transforming mutational stage
|
||||
|
@ -86,7 +86,7 @@ where
|
||||
E::Observers: ObserversTuple<<S::Corpus as Corpus>::Input, S>,
|
||||
E: Executor<EM, Z, State = S> + HasObservers + HasTimeout,
|
||||
EM: UsesState<State = S>,
|
||||
Z: Evaluator<E, EM, State = S>,
|
||||
Z: Evaluator<E, EM, <S::Corpus as Corpus>::Input, S>,
|
||||
S: HasCorpus + HasMetadata + UsesInput<Input = <S::Corpus as Corpus>::Input>,
|
||||
<S::Corpus as Corpus>::Input: Debug + Serialize + DeserializeOwned + Default + 'static + Clone,
|
||||
{
|
||||
|
@ -725,7 +725,7 @@ where
|
||||
where
|
||||
E: UsesState<State = Self>,
|
||||
EM: EventFirer<State = Self>,
|
||||
Z: Evaluator<E, EM, State = Self>,
|
||||
Z: Evaluator<E, EM, I, Self>,
|
||||
{
|
||||
if let Some(remaining) = self.remaining_initial_files.as_ref() {
|
||||
// everything was loaded
|
||||
@ -750,7 +750,7 @@ where
|
||||
where
|
||||
E: UsesState<State = Self>,
|
||||
EM: EventFirer<State = Self>,
|
||||
Z: Evaluator<E, EM, State = Self>,
|
||||
Z: Evaluator<E, EM, I, Self>,
|
||||
{
|
||||
log::info!("Loading file {:?} ...", &path);
|
||||
let input = (config.loader)(fuzzer, self, path)?;
|
||||
@ -779,7 +779,7 @@ where
|
||||
where
|
||||
E: UsesState<State = Self>,
|
||||
EM: EventFirer<State = Self>,
|
||||
Z: Evaluator<E, EM, State = Self>,
|
||||
Z: Evaluator<E, EM, I, Self>,
|
||||
{
|
||||
loop {
|
||||
match self.next_file() {
|
||||
@ -844,7 +844,7 @@ where
|
||||
where
|
||||
E: UsesState<State = Self>,
|
||||
EM: EventFirer<State = Self>,
|
||||
Z: Evaluator<E, EM, State = Self>,
|
||||
Z: Evaluator<E, EM, I, Self>,
|
||||
{
|
||||
self.load_initial_inputs_custom_by_filenames(
|
||||
fuzzer,
|
||||
@ -872,7 +872,7 @@ where
|
||||
where
|
||||
E: UsesState<State = Self>,
|
||||
EM: EventFirer<State = Self>,
|
||||
Z: Evaluator<E, EM, State = Self>,
|
||||
Z: Evaluator<E, EM, I, Self>,
|
||||
{
|
||||
self.canonicalize_input_dirs(in_dirs)?;
|
||||
self.continue_loading_initial_inputs_custom(
|
||||
@ -899,7 +899,7 @@ where
|
||||
where
|
||||
E: UsesState<State = Self>,
|
||||
EM: EventFirer<State = Self>,
|
||||
Z: Evaluator<E, EM, State = Self>,
|
||||
Z: Evaluator<E, EM, I, Self>,
|
||||
{
|
||||
self.load_initial_inputs_custom_by_filenames(
|
||||
fuzzer,
|
||||
@ -925,7 +925,7 @@ where
|
||||
where
|
||||
E: UsesState<State = Self>,
|
||||
EM: EventFirer<State = Self>,
|
||||
Z: Evaluator<E, EM, State = Self>,
|
||||
Z: Evaluator<E, EM, I, Self>,
|
||||
{
|
||||
self.canonicalize_input_dirs(in_dirs)?;
|
||||
self.continue_loading_initial_inputs_custom(
|
||||
@ -952,7 +952,7 @@ where
|
||||
where
|
||||
E: UsesState<State = Self>,
|
||||
EM: EventFirer<State = Self>,
|
||||
Z: Evaluator<E, EM, State = Self>,
|
||||
Z: Evaluator<E, EM, I, Self>,
|
||||
{
|
||||
self.canonicalize_input_dirs(in_dirs)?;
|
||||
self.continue_loading_initial_inputs_custom(
|
||||
@ -994,7 +994,7 @@ where
|
||||
where
|
||||
E: UsesState<State = Self>,
|
||||
EM: EventFirer<State = Self>,
|
||||
Z: Evaluator<E, EM, State = Self>,
|
||||
Z: Evaluator<E, EM, I, Self>,
|
||||
{
|
||||
if self.multicore_inputs_processed.unwrap_or(false) {
|
||||
self.continue_loading_initial_inputs_custom(
|
||||
@ -1090,7 +1090,7 @@ where
|
||||
E: UsesState<State = Self>,
|
||||
EM: EventFirer<State = Self>,
|
||||
G: Generator<<Self as UsesInput>::Input, Self>,
|
||||
Z: Evaluator<E, EM, State = Self>,
|
||||
Z: Evaluator<E, EM, I, Self>,
|
||||
{
|
||||
let mut added = 0;
|
||||
for _ in 0..num {
|
||||
@ -1129,7 +1129,7 @@ where
|
||||
E: UsesState<State = Self>,
|
||||
EM: EventFirer<State = Self>,
|
||||
G: Generator<<Self as UsesInput>::Input, Self>,
|
||||
Z: Evaluator<E, EM, State = Self>,
|
||||
Z: Evaluator<E, EM, I, Self>,
|
||||
{
|
||||
self.generate_initial_internal(fuzzer, executor, generator, manager, num, true)
|
||||
}
|
||||
@ -1147,7 +1147,7 @@ where
|
||||
E: UsesState<State = Self>,
|
||||
EM: EventFirer<State = Self>,
|
||||
G: Generator<<Self as UsesInput>::Input, Self>,
|
||||
Z: Evaluator<E, EM, State = Self>,
|
||||
Z: Evaluator<E, EM, I, Self>,
|
||||
{
|
||||
self.generate_initial_internal(fuzzer, executor, generator, manager, num, false)
|
||||
}
|
||||
|
@ -74,7 +74,6 @@ where
|
||||
TC: TargetBytesConverter<Input = S::Input>,
|
||||
OT: ObserversTuple<S::Input, S>,
|
||||
RT: FridaRuntimeTuple,
|
||||
Z: UsesState<State = S>,
|
||||
{
|
||||
/// Instruct the target about the input and run
|
||||
#[inline]
|
||||
|
@ -62,7 +62,7 @@ fn do_fuzz<F, ST, E, S, EM>(
|
||||
mgr: &mut EM,
|
||||
) -> Result<(), Error>
|
||||
where
|
||||
F: Fuzzer<E, EM, ST, State = S>,
|
||||
F: Fuzzer<E, EM, S, ST>,
|
||||
S: HasMetadata
|
||||
+ HasExecutions
|
||||
+ UsesInput
|
||||
|
@ -23,7 +23,7 @@ fn do_report<F, ST, E, S, EM>(
|
||||
_mgr: &mut EM,
|
||||
) -> Result<(), Error>
|
||||
where
|
||||
F: Fuzzer<E, EM, ST, State = S>,
|
||||
F: Fuzzer<E, EM, S, ST>,
|
||||
S: HasMetadata
|
||||
+ HasNamedMetadata
|
||||
+ HasExecutions
|
||||
|
@ -13,7 +13,7 @@ use libafl::{
|
||||
schedulers::QueueScheduler,
|
||||
stages::StdTMinMutationalStage,
|
||||
state::{HasCorpus, StdState},
|
||||
Error, Fuzzer, StdFuzzer,
|
||||
Error, ExecutesInput, Fuzzer, StdFuzzer,
|
||||
};
|
||||
use libafl_bolts::{
|
||||
rands::{RomuDuoJrRand, StdRand},
|
||||
|
@ -50,7 +50,6 @@ where
|
||||
EM: UsesState<State = S>,
|
||||
S: State + HasExecutions,
|
||||
S::Input: HasTargetBytes,
|
||||
Z: UsesState<State = S>,
|
||||
OT: ObserversTuple<S::Input, S>,
|
||||
{
|
||||
fn run_target(
|
||||
|
@ -98,7 +98,7 @@ pub unsafe fn inproc_qemu_timeout_handler<E, EM, ET, OF, S, Z>(
|
||||
ET: EmulatorModuleTuple<S>,
|
||||
OF: Feedback<EM, E::Input, E::Observers, E::State>,
|
||||
S: State + Unpin,
|
||||
Z: HasObjective<Objective = OF, State = E::State>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
<<E as UsesState>::State as HasSolutions>::Solutions: Corpus<Input = E::Input>, //delete me
|
||||
<<<E as UsesState>::State as HasCorpus>::Corpus as Corpus>::Input: Clone, //delete me
|
||||
{
|
||||
@ -166,9 +166,10 @@ where
|
||||
EM: EventFirer<State = S> + EventRestarter<State = S>,
|
||||
OF: Feedback<EM, S::Input, OT, S>,
|
||||
S: Unpin + State + HasExecutions + HasCorpus + HasSolutions,
|
||||
Z: HasObjective<Objective = OF, State = S>
|
||||
+ HasScheduler<State = S>
|
||||
+ ExecutionProcessor<EM, OT>,
|
||||
S::Corpus: Corpus<Input = S::Input>,
|
||||
Z: HasObjective<Objective = OF>
|
||||
+ HasScheduler<<S::Corpus as Corpus>::Input, S>
|
||||
+ ExecutionProcessor<EM, <S::Corpus as Corpus>::Input, OT, S>,
|
||||
S::Solutions: Corpus<Input = S::Input>, //delete me
|
||||
<S::Corpus as Corpus>::Input: Clone, //delete me
|
||||
{
|
||||
@ -241,7 +242,6 @@ where
|
||||
H: FnMut(&mut Emulator<CM, ED, ET, S, SM>, &mut S, &S::Input) -> ExitKind,
|
||||
OT: ObserversTuple<S::Input, S>,
|
||||
S: State + HasExecutions + Unpin,
|
||||
Z: UsesState<State = S>,
|
||||
{
|
||||
fn run_target(
|
||||
&mut self,
|
||||
@ -315,7 +315,6 @@ where
|
||||
OT: ObserversTuple<S::Input, S>,
|
||||
S: UsesInput,
|
||||
SP: ShMemProvider,
|
||||
Z: UsesState<State = S>,
|
||||
{
|
||||
inner: QemuInProcessForkExecutor<'a, CM, ED, EM, ET, H, OT, S, SM, SP, Z>,
|
||||
}
|
||||
@ -333,7 +332,6 @@ where
|
||||
S: UsesInput + Debug,
|
||||
SM: Debug,
|
||||
SP: ShMemProvider,
|
||||
Z: UsesState<State = S>,
|
||||
{
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("QemuForkExecutor")
|
||||
@ -354,7 +352,7 @@ where
|
||||
OT: ObserversTuple<S::Input, S>,
|
||||
S: State + HasSolutions,
|
||||
SP: ShMemProvider,
|
||||
Z: HasObjective<State = S>,
|
||||
Z: HasObjective,
|
||||
Z::Objective: Feedback<EM, S::Input, OT, S>,
|
||||
{
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
@ -416,7 +414,7 @@ where
|
||||
OT: ObserversTuple<S::Input, S> + Debug,
|
||||
S: State + HasExecutions + Unpin,
|
||||
SP: ShMemProvider,
|
||||
Z: HasObjective<Objective = OF, State = S>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
{
|
||||
fn run_target(
|
||||
&mut self,
|
||||
@ -452,7 +450,6 @@ where
|
||||
OT: ObserversTuple<S::Input, S>,
|
||||
S: State,
|
||||
SP: ShMemProvider,
|
||||
Z: UsesState<State = S>,
|
||||
{
|
||||
type State = S;
|
||||
}
|
||||
@ -468,7 +465,6 @@ where
|
||||
OT: ObserversTuple<S::Input, S>,
|
||||
S: State,
|
||||
SP: ShMemProvider,
|
||||
Z: UsesState<State = S>,
|
||||
{
|
||||
type Observers = OT;
|
||||
#[inline]
|
||||
|
@ -38,7 +38,6 @@ impl<EM, TE, S, Z> Named for AFLppCmplogTracingStage<'_, EM, TE, S, Z> {
|
||||
impl<E, EM, TE, S, Z> Stage<E, EM, S, Z> for AFLppCmplogTracingStage<'_, EM, TE, S, Z>
|
||||
where
|
||||
EM: UsesState<State = S>,
|
||||
Z: UsesState<State = S>,
|
||||
TE: HasObservers + Executor<EM, Z, State = S>,
|
||||
TE::Observers: MatchNameRef + ObserversTuple<BytesInput, S>,
|
||||
S: HasCorpus
|
||||
|
@ -37,7 +37,7 @@ where
|
||||
OF: Feedback<EM, E::Input, E::Observers, E::State>,
|
||||
E::State: HasSolutions + HasCorpus + HasExecutions,
|
||||
E::Observers: ObserversTuple<<E::State as UsesInput>::Input, E::State>,
|
||||
Z: HasObjective<Objective = OF, State = E::State>,
|
||||
Z: HasObjective<Objective = OF>,
|
||||
<<E as UsesState>::State as HasSolutions>::Solutions: Corpus<Input = E::Input>, //delete me
|
||||
<<<E as UsesState>::State as HasCorpus>::Corpus as Corpus>::Input: Clone, //delete me
|
||||
{
|
||||
|
@ -54,7 +54,6 @@ where
|
||||
S: State + HasExecutions,
|
||||
S::Input: HasTargetBytes,
|
||||
SP: ShMemProvider,
|
||||
Z: UsesState<State = S>,
|
||||
{
|
||||
#[inline]
|
||||
fn run_target(
|
||||
|
Loading…
x
Reference in New Issue
Block a user