* Fix status updates for crashing fuzzers (fixes #1367) * client perf fix * Add HasLastReportTime trait :/ * ****** prelude * reoder phantom * fix tests * clippy, fixes * more fixes, traits are maaad * fmt
This commit is contained in:
parent
003b219826
commit
36b1d8aea2
@ -23,7 +23,7 @@ use crate::{
|
|||||||
fuzzer::{EvaluatorObservers, ExecutionProcessor},
|
fuzzer::{EvaluatorObservers, ExecutionProcessor},
|
||||||
inputs::UsesInput,
|
inputs::UsesInput,
|
||||||
observers::ObserversTuple,
|
observers::ObserversTuple,
|
||||||
state::{HasClientPerfMonitor, HasExecutions, HasMetadata, UsesState},
|
state::{HasClientPerfMonitor, HasExecutions, HasLastReportTime, HasMetadata, UsesState},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -324,7 +324,7 @@ where
|
|||||||
impl<E, EM, SP, Z> EventManager<E, Z> for CentralizedEventManager<EM, SP>
|
impl<E, EM, SP, Z> EventManager<E, Z> for CentralizedEventManager<EM, SP>
|
||||||
where
|
where
|
||||||
EM: EventStatsCollector + EventManager<E, Z>,
|
EM: EventStatsCollector + EventManager<E, Z>,
|
||||||
EM::State: HasClientPerfMonitor + HasExecutions + HasMetadata,
|
EM::State: HasClientPerfMonitor + HasExecutions + HasMetadata + HasLastReportTime,
|
||||||
SP: ShMemProvider,
|
SP: ShMemProvider,
|
||||||
E: HasObservers<State = Self::State> + Executor<Self, Z>,
|
E: HasObservers<State = Self::State> + Executor<Self, Z>,
|
||||||
for<'a> E::Observers: Deserialize<'a>,
|
for<'a> E::Observers: Deserialize<'a>,
|
||||||
@ -352,7 +352,7 @@ where
|
|||||||
impl<EM, SP> ProgressReporter for CentralizedEventManager<EM, SP>
|
impl<EM, SP> ProgressReporter for CentralizedEventManager<EM, SP>
|
||||||
where
|
where
|
||||||
EM: EventStatsCollector + ProgressReporter + HasEventManagerId,
|
EM: EventStatsCollector + ProgressReporter + HasEventManagerId,
|
||||||
EM::State: HasClientPerfMonitor + HasMetadata + HasExecutions,
|
EM::State: HasClientPerfMonitor + HasMetadata + HasExecutions + HasLastReportTime,
|
||||||
SP: ShMemProvider,
|
SP: ShMemProvider,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@ use crate::{
|
|||||||
inputs::{Input, InputConverter, UsesInput},
|
inputs::{Input, InputConverter, UsesInput},
|
||||||
monitors::Monitor,
|
monitors::Monitor,
|
||||||
observers::ObserversTuple,
|
observers::ObserversTuple,
|
||||||
state::{HasClientPerfMonitor, HasExecutions, HasMetadata, UsesState},
|
state::{HasClientPerfMonitor, HasExecutions, HasLastReportTime, HasMetadata, UsesState},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -788,7 +788,7 @@ impl<E, S, SP, Z> EventManager<E, Z> for LlmpEventManager<S, SP>
|
|||||||
where
|
where
|
||||||
E: HasObservers<State = S> + Executor<Self, Z>,
|
E: HasObservers<State = S> + Executor<Self, Z>,
|
||||||
for<'a> E::Observers: Deserialize<'a>,
|
for<'a> E::Observers: Deserialize<'a>,
|
||||||
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata,
|
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata + HasLastReportTime,
|
||||||
SP: ShMemProvider,
|
SP: ShMemProvider,
|
||||||
Z: EvaluatorObservers<E::Observers, State = S> + ExecutionProcessor<E::Observers, State = S>,
|
Z: EvaluatorObservers<E::Observers, State = S> + ExecutionProcessor<E::Observers, State = S>,
|
||||||
{
|
{
|
||||||
@ -809,7 +809,7 @@ where
|
|||||||
|
|
||||||
impl<S, SP> ProgressReporter for LlmpEventManager<S, SP>
|
impl<S, SP> ProgressReporter for LlmpEventManager<S, SP>
|
||||||
where
|
where
|
||||||
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata,
|
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata + HasLastReportTime,
|
||||||
SP: ShMemProvider,
|
SP: ShMemProvider,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -895,7 +895,12 @@ where
|
|||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
impl<S, SP> ProgressReporter for LlmpRestartingEventManager<S, SP>
|
impl<S, SP> ProgressReporter for LlmpRestartingEventManager<S, SP>
|
||||||
where
|
where
|
||||||
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata + Serialize,
|
S: UsesInput
|
||||||
|
+ HasExecutions
|
||||||
|
+ HasClientPerfMonitor
|
||||||
|
+ HasMetadata
|
||||||
|
+ HasLastReportTime
|
||||||
|
+ Serialize,
|
||||||
SP: ShMemProvider,
|
SP: ShMemProvider,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -979,7 +984,12 @@ impl<E, S, SP, Z> EventManager<E, Z> for LlmpRestartingEventManager<S, SP>
|
|||||||
where
|
where
|
||||||
E: HasObservers<State = S> + Executor<LlmpEventManager<S, SP>, Z>,
|
E: HasObservers<State = S> + Executor<LlmpEventManager<S, SP>, Z>,
|
||||||
for<'a> E::Observers: Deserialize<'a>,
|
for<'a> E::Observers: Deserialize<'a>,
|
||||||
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata + Serialize,
|
S: UsesInput
|
||||||
|
+ HasExecutions
|
||||||
|
+ HasClientPerfMonitor
|
||||||
|
+ HasMetadata
|
||||||
|
+ HasLastReportTime
|
||||||
|
+ Serialize,
|
||||||
SP: ShMemProvider + 'static,
|
SP: ShMemProvider + 'static,
|
||||||
Z: EvaluatorObservers<E::Observers, State = S> + ExecutionProcessor<E::Observers>, //CE: CustomEvent<I>,
|
Z: EvaluatorObservers<E::Observers, State = S> + ExecutionProcessor<E::Observers>, //CE: CustomEvent<I>,
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,7 @@ use crate::{
|
|||||||
inputs::Input,
|
inputs::Input,
|
||||||
monitors::UserStats,
|
monitors::UserStats,
|
||||||
observers::ObserversTuple,
|
observers::ObserversTuple,
|
||||||
state::{HasClientPerfMonitor, HasExecutions, HasMetadata},
|
state::{HasClientPerfMonitor, HasExecutions, HasLastReportTime, HasMetadata},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -451,7 +451,7 @@ pub trait EventFirer: UsesState {
|
|||||||
/// [`ProgressReporter`] report progress to the broker.
|
/// [`ProgressReporter`] report progress to the broker.
|
||||||
pub trait ProgressReporter: EventFirer
|
pub trait ProgressReporter: EventFirer
|
||||||
where
|
where
|
||||||
Self::State: HasClientPerfMonitor + HasMetadata + HasExecutions,
|
Self::State: HasClientPerfMonitor + HasMetadata + HasExecutions + HasLastReportTime,
|
||||||
{
|
{
|
||||||
/// Given the last time, if `monitor_timeout` seconds passed, send off an info/monitor/heartbeat message to the broker.
|
/// Given the last time, if `monitor_timeout` seconds passed, send off an info/monitor/heartbeat message to the broker.
|
||||||
/// Returns the new `last` time (so the old one, unless `monitor_timeout` time has passed and monitor have been sent)
|
/// Returns the new `last` time (so the old one, unless `monitor_timeout` time has passed and monitor have been sent)
|
||||||
@ -459,18 +459,20 @@ where
|
|||||||
fn maybe_report_progress(
|
fn maybe_report_progress(
|
||||||
&mut self,
|
&mut self,
|
||||||
state: &mut Self::State,
|
state: &mut Self::State,
|
||||||
last_report_time: Duration,
|
|
||||||
monitor_timeout: Duration,
|
monitor_timeout: Duration,
|
||||||
) -> Result<Duration, Error> {
|
) -> Result<(), Error> {
|
||||||
|
let Some(last_report_time) = state.last_report_time() else {
|
||||||
|
// this is the first time we execute, no need to report progress just yet.
|
||||||
|
*state.last_report_time_mut() = Some(current_time());
|
||||||
|
return Ok(());
|
||||||
|
};
|
||||||
let cur = current_time();
|
let cur = current_time();
|
||||||
// default to 0 here to avoid crashes on clock skew
|
// default to 0 here to avoid crashes on clock skew
|
||||||
if cur.checked_sub(last_report_time).unwrap_or_default() > monitor_timeout {
|
if cur.checked_sub(*last_report_time).unwrap_or_default() > monitor_timeout {
|
||||||
|
// report_progress sets a new `last_report_time` internally.
|
||||||
self.report_progress(state)?;
|
self.report_progress(state)?;
|
||||||
|
|
||||||
Ok(cur)
|
|
||||||
} else {
|
|
||||||
Ok(last_report_time)
|
|
||||||
}
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Send off an info/monitor/heartbeat message to the broker.
|
/// Send off an info/monitor/heartbeat message to the broker.
|
||||||
@ -510,6 +512,8 @@ where
|
|||||||
)?;
|
)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*state.last_report_time_mut() = Some(cur);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -558,7 +562,7 @@ pub trait HasEventManagerId {
|
|||||||
pub trait EventManager<E, Z>:
|
pub trait EventManager<E, Z>:
|
||||||
EventFirer + EventProcessor<E, Z> + EventRestarter + HasEventManagerId + ProgressReporter
|
EventFirer + EventProcessor<E, Z> + EventRestarter + HasEventManagerId + ProgressReporter
|
||||||
where
|
where
|
||||||
Self::State: HasClientPerfMonitor + HasMetadata + HasExecutions,
|
Self::State: HasClientPerfMonitor + HasMetadata + HasExecutions + HasLastReportTime,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -625,7 +629,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<E, S, Z> EventManager<E, Z> for NopEventManager<S> where
|
impl<E, S, Z> EventManager<E, Z> for NopEventManager<S> where
|
||||||
S: UsesInput + HasClientPerfMonitor + HasExecutions + HasMetadata
|
S: UsesInput + HasClientPerfMonitor + HasExecutions + HasLastReportTime + HasMetadata
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -643,7 +647,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<S> ProgressReporter for NopEventManager<S> where
|
impl<S> ProgressReporter for NopEventManager<S> where
|
||||||
S: UsesInput + HasClientPerfMonitor + HasExecutions + HasMetadata
|
S: UsesInput + HasClientPerfMonitor + HasExecutions + HasLastReportTime + HasMetadata
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ use crate::{
|
|||||||
},
|
},
|
||||||
inputs::UsesInput,
|
inputs::UsesInput,
|
||||||
monitors::Monitor,
|
monitors::Monitor,
|
||||||
state::{HasClientPerfMonitor, HasExecutions, HasMetadata, UsesState},
|
state::{HasClientPerfMonitor, HasExecutions, HasLastReportTime, HasMetadata, UsesState},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
@ -132,7 +132,7 @@ where
|
|||||||
impl<E, MT, S, Z> EventManager<E, Z> for SimpleEventManager<MT, S>
|
impl<E, MT, S, Z> EventManager<E, Z> for SimpleEventManager<MT, S>
|
||||||
where
|
where
|
||||||
MT: Monitor,
|
MT: Monitor,
|
||||||
S: UsesInput + HasClientPerfMonitor + HasExecutions + HasMetadata,
|
S: UsesInput + HasClientPerfMonitor + HasExecutions + HasLastReportTime + HasMetadata,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ where
|
|||||||
impl<MT, S> ProgressReporter for SimpleEventManager<MT, S>
|
impl<MT, S> ProgressReporter for SimpleEventManager<MT, S>
|
||||||
where
|
where
|
||||||
MT: Monitor,
|
MT: Monitor,
|
||||||
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata,
|
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata + HasLastReportTime,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,7 +379,12 @@ where
|
|||||||
impl<E, MT, S, SP, Z> EventManager<E, Z> for SimpleRestartingEventManager<MT, S, SP>
|
impl<E, MT, S, SP, Z> EventManager<E, Z> for SimpleRestartingEventManager<MT, S, SP>
|
||||||
where
|
where
|
||||||
MT: Monitor,
|
MT: Monitor,
|
||||||
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata + Serialize,
|
S: UsesInput
|
||||||
|
+ HasExecutions
|
||||||
|
+ HasClientPerfMonitor
|
||||||
|
+ HasMetadata
|
||||||
|
+ HasLastReportTime
|
||||||
|
+ Serialize,
|
||||||
SP: ShMemProvider,
|
SP: ShMemProvider,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -403,7 +408,7 @@ where
|
|||||||
impl<MT, S, SP> ProgressReporter for SimpleRestartingEventManager<MT, S, SP>
|
impl<MT, S, SP> ProgressReporter for SimpleRestartingEventManager<MT, S, SP>
|
||||||
where
|
where
|
||||||
MT: Monitor,
|
MT: Monitor,
|
||||||
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata,
|
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata + HasLastReportTime,
|
||||||
SP: ShMemProvider,
|
SP: ShMemProvider,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,7 @@ use crate::{
|
|||||||
fuzzer::{EvaluatorObservers, ExecutionProcessor},
|
fuzzer::{EvaluatorObservers, ExecutionProcessor},
|
||||||
inputs::{Input, UsesInput},
|
inputs::{Input, UsesInput},
|
||||||
monitors::Monitor,
|
monitors::Monitor,
|
||||||
state::{HasClientPerfMonitor, HasExecutions, HasMetadata, UsesState},
|
state::{HasClientPerfMonitor, HasExecutions, HasLastReportTime, HasMetadata, UsesState},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -622,7 +622,7 @@ impl<E, S, Z> EventManager<E, Z> for TcpEventManager<S>
|
|||||||
where
|
where
|
||||||
E: HasObservers<State = S> + Executor<Self, Z>,
|
E: HasObservers<State = S> + Executor<Self, Z>,
|
||||||
for<'a> E::Observers: Deserialize<'a>,
|
for<'a> E::Observers: Deserialize<'a>,
|
||||||
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata,
|
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata + HasLastReportTime,
|
||||||
Z: EvaluatorObservers<E::Observers, State = S> + ExecutionProcessor<E::Observers, State = S>,
|
Z: EvaluatorObservers<E::Observers, State = S> + ExecutionProcessor<E::Observers, State = S>,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -640,7 +640,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<S> ProgressReporter for TcpEventManager<S> where
|
impl<S> ProgressReporter for TcpEventManager<S> where
|
||||||
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata
|
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata + HasLastReportTime
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -683,7 +683,12 @@ where
|
|||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
impl<S, SP> ProgressReporter for TcpRestartingEventManager<S, SP>
|
impl<S, SP> ProgressReporter for TcpRestartingEventManager<S, SP>
|
||||||
where
|
where
|
||||||
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata + Serialize,
|
S: UsesInput
|
||||||
|
+ HasExecutions
|
||||||
|
+ HasClientPerfMonitor
|
||||||
|
+ HasMetadata
|
||||||
|
+ HasLastReportTime
|
||||||
|
+ Serialize,
|
||||||
SP: ShMemProvider,
|
SP: ShMemProvider,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -758,7 +763,12 @@ impl<E, S, SP, Z> EventManager<E, Z> for TcpRestartingEventManager<S, SP>
|
|||||||
where
|
where
|
||||||
E: HasObservers<State = S> + Executor<TcpEventManager<S>, Z>,
|
E: HasObservers<State = S> + Executor<TcpEventManager<S>, Z>,
|
||||||
for<'a> E::Observers: Deserialize<'a>,
|
for<'a> E::Observers: Deserialize<'a>,
|
||||||
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata + Serialize,
|
S: UsesInput
|
||||||
|
+ HasExecutions
|
||||||
|
+ HasClientPerfMonitor
|
||||||
|
+ HasMetadata
|
||||||
|
+ HasLastReportTime
|
||||||
|
+ Serialize,
|
||||||
SP: ShMemProvider + 'static,
|
SP: ShMemProvider + 'static,
|
||||||
Z: EvaluatorObservers<E::Observers, State = S> + ExecutionProcessor<E::Observers>, //CE: CustomEvent<I>,
|
Z: EvaluatorObservers<E::Observers, State = S> + ExecutionProcessor<E::Observers>, //CE: CustomEvent<I>,
|
||||||
{
|
{
|
||||||
|
@ -23,7 +23,10 @@ use crate::{
|
|||||||
schedulers::Scheduler,
|
schedulers::Scheduler,
|
||||||
stages::StagesTuple,
|
stages::StagesTuple,
|
||||||
start_timer,
|
start_timer,
|
||||||
state::{HasClientPerfMonitor, HasCorpus, HasExecutions, HasMetadata, HasSolutions, UsesState},
|
state::{
|
||||||
|
HasClientPerfMonitor, HasCorpus, HasExecutions, HasLastReportTime, HasMetadata,
|
||||||
|
HasSolutions, UsesState,
|
||||||
|
},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -155,7 +158,7 @@ where
|
|||||||
/// The main fuzzer trait.
|
/// The main fuzzer trait.
|
||||||
pub trait Fuzzer<E, EM, ST>: Sized + UsesState
|
pub trait Fuzzer<E, EM, ST>: Sized + UsesState
|
||||||
where
|
where
|
||||||
Self::State: HasClientPerfMonitor + HasMetadata + HasExecutions,
|
Self::State: HasClientPerfMonitor + HasMetadata + HasExecutions + HasLastReportTime,
|
||||||
E: UsesState<State = Self::State>,
|
E: UsesState<State = Self::State>,
|
||||||
EM: ProgressReporter<State = Self::State>,
|
EM: ProgressReporter<State = Self::State>,
|
||||||
ST: StagesTuple<E, EM, Self::State, Self>,
|
ST: StagesTuple<E, EM, Self::State, Self>,
|
||||||
@ -185,11 +188,10 @@ where
|
|||||||
state: &mut EM::State,
|
state: &mut EM::State,
|
||||||
manager: &mut EM,
|
manager: &mut EM,
|
||||||
) -> Result<CorpusId, Error> {
|
) -> Result<CorpusId, Error> {
|
||||||
let mut last = current_time();
|
|
||||||
let monitor_timeout = STATS_TIMEOUT_DEFAULT;
|
let monitor_timeout = STATS_TIMEOUT_DEFAULT;
|
||||||
loop {
|
loop {
|
||||||
|
manager.maybe_report_progress(state, monitor_timeout)?;
|
||||||
self.fuzz_one(stages, executor, state, manager)?;
|
self.fuzz_one(stages, executor, state, manager)?;
|
||||||
last = manager.maybe_report_progress(state, last, monitor_timeout)?;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,12 +219,11 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
let mut ret = None;
|
let mut ret = None;
|
||||||
let mut last = current_time();
|
|
||||||
let monitor_timeout = STATS_TIMEOUT_DEFAULT;
|
let monitor_timeout = STATS_TIMEOUT_DEFAULT;
|
||||||
|
|
||||||
for _ in 0..iters {
|
for _ in 0..iters {
|
||||||
|
manager.maybe_report_progress(state, monitor_timeout)?;
|
||||||
ret = Some(self.fuzz_one(stages, executor, state, manager)?);
|
ret = Some(self.fuzz_one(stages, executor, state, manager)?);
|
||||||
last = manager.maybe_report_progress(state, last, monitor_timeout)?;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
manager.report_progress(state)?;
|
manager.report_progress(state)?;
|
||||||
@ -575,7 +576,12 @@ where
|
|||||||
EM: ProgressReporter + EventProcessor<E, Self, State = CS::State>,
|
EM: ProgressReporter + EventProcessor<E, Self, State = CS::State>,
|
||||||
F: Feedback<CS::State>,
|
F: Feedback<CS::State>,
|
||||||
OF: Feedback<CS::State>,
|
OF: Feedback<CS::State>,
|
||||||
CS::State: HasClientPerfMonitor + HasExecutions + HasMetadata + HasCorpus + HasTestcase,
|
CS::State: HasClientPerfMonitor
|
||||||
|
+ HasExecutions
|
||||||
|
+ HasMetadata
|
||||||
|
+ HasCorpus
|
||||||
|
+ HasTestcase
|
||||||
|
+ HasLastReportTime,
|
||||||
ST: StagesTuple<E, EM, CS::State, Self>,
|
ST: StagesTuple<E, EM, CS::State, Self>,
|
||||||
{
|
{
|
||||||
fn fuzz_one(
|
fn fuzz_one(
|
||||||
|
@ -66,7 +66,10 @@ use crate::{
|
|||||||
inputs::UsesInput,
|
inputs::UsesInput,
|
||||||
observers::ObserversTuple,
|
observers::ObserversTuple,
|
||||||
schedulers::Scheduler,
|
schedulers::Scheduler,
|
||||||
state::{HasClientPerfMonitor, HasCorpus, HasExecutions, HasMetadata, HasRand, UsesState},
|
state::{
|
||||||
|
HasClientPerfMonitor, HasCorpus, HasExecutions, HasLastReportTime, HasMetadata, HasRand,
|
||||||
|
UsesState,
|
||||||
|
},
|
||||||
Error, EvaluatorObservers, ExecutesInput, ExecutionProcessor, HasScheduler,
|
Error, EvaluatorObservers, ExecutesInput, ExecutionProcessor, HasScheduler,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -248,7 +251,12 @@ where
|
|||||||
impl<CS, E, EM, OT, PS, Z> Stage<E, EM, Z> for PushStageAdapter<CS, EM, OT, PS, Z>
|
impl<CS, E, EM, OT, PS, Z> Stage<E, EM, Z> for PushStageAdapter<CS, EM, OT, PS, Z>
|
||||||
where
|
where
|
||||||
CS: Scheduler,
|
CS: Scheduler,
|
||||||
CS::State: HasClientPerfMonitor + HasExecutions + HasMetadata + HasRand + HasCorpus,
|
CS::State: HasClientPerfMonitor
|
||||||
|
+ HasExecutions
|
||||||
|
+ HasMetadata
|
||||||
|
+ HasRand
|
||||||
|
+ HasCorpus
|
||||||
|
+ HasLastReportTime,
|
||||||
E: Executor<EM, Z> + HasObservers<Observers = OT, State = CS::State>,
|
E: Executor<EM, Z> + HasObservers<Observers = OT, State = CS::State>,
|
||||||
EM: EventFirer<State = CS::State>
|
EM: EventFirer<State = CS::State>
|
||||||
+ EventRestarter
|
+ EventRestarter
|
||||||
|
@ -16,14 +16,15 @@ use core::{
|
|||||||
pub use mutational::StdMutationalPushStage;
|
pub use mutational::StdMutationalPushStage;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
bolts::current_time,
|
|
||||||
corpus::CorpusId,
|
corpus::CorpusId,
|
||||||
events::{EventFirer, EventRestarter, HasEventManagerId, ProgressReporter},
|
events::{EventFirer, EventRestarter, HasEventManagerId, ProgressReporter},
|
||||||
executors::ExitKind,
|
executors::ExitKind,
|
||||||
inputs::UsesInput,
|
inputs::UsesInput,
|
||||||
observers::ObserversTuple,
|
observers::ObserversTuple,
|
||||||
schedulers::Scheduler,
|
schedulers::Scheduler,
|
||||||
state::{HasClientPerfMonitor, HasCorpus, HasExecutions, HasMetadata, HasRand},
|
state::{
|
||||||
|
HasClientPerfMonitor, HasCorpus, HasExecutions, HasLastReportTime, HasMetadata, HasRand,
|
||||||
|
},
|
||||||
Error, EvaluatorObservers, ExecutionProcessor, HasScheduler,
|
Error, EvaluatorObservers, ExecutionProcessor, HasScheduler,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -92,8 +93,6 @@ where
|
|||||||
/// If this stage has already been initalized.
|
/// If this stage has already been initalized.
|
||||||
/// This gets reset to `false` after one iteration of the stage is done.
|
/// This gets reset to `false` after one iteration of the stage is done.
|
||||||
pub initialized: bool,
|
pub initialized: bool,
|
||||||
/// The last time the monitor was updated
|
|
||||||
pub last_monitor_time: Duration,
|
|
||||||
/// The shared state, keeping track of the corpus and the fuzzer
|
/// The shared state, keeping track of the corpus and the fuzzer
|
||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
pub shared_state: Rc<RefCell<Option<PushStageSharedState<CS, EM, OT, Z>>>>,
|
pub shared_state: Rc<RefCell<Option<PushStageSharedState<CS, EM, OT, Z>>>>,
|
||||||
@ -132,7 +131,6 @@ where
|
|||||||
shared_state,
|
shared_state,
|
||||||
initialized: false,
|
initialized: false,
|
||||||
phantom: PhantomData,
|
phantom: PhantomData,
|
||||||
last_monitor_time: current_time(),
|
|
||||||
exit_kind: exit_kind_ref,
|
exit_kind: exit_kind_ref,
|
||||||
errored: false,
|
errored: false,
|
||||||
current_input: None,
|
current_input: None,
|
||||||
@ -184,7 +182,12 @@ where
|
|||||||
pub trait PushStage<CS, EM, OT, Z>: Iterator
|
pub trait PushStage<CS, EM, OT, Z>: Iterator
|
||||||
where
|
where
|
||||||
CS: Scheduler,
|
CS: Scheduler,
|
||||||
CS::State: HasClientPerfMonitor + HasRand + HasExecutions + HasMetadata + HasCorpus,
|
CS::State: HasClientPerfMonitor
|
||||||
|
+ HasRand
|
||||||
|
+ HasExecutions
|
||||||
|
+ HasMetadata
|
||||||
|
+ HasCorpus
|
||||||
|
+ HasLastReportTime,
|
||||||
EM: EventFirer<State = CS::State> + EventRestarter + HasEventManagerId + ProgressReporter,
|
EM: EventFirer<State = CS::State> + EventRestarter + HasEventManagerId + ProgressReporter,
|
||||||
OT: ObserversTuple<CS::State>,
|
OT: ObserversTuple<CS::State>,
|
||||||
Z: ExecutionProcessor<OT, State = CS::State>
|
Z: ExecutionProcessor<OT, State = CS::State>
|
||||||
@ -307,22 +310,13 @@ where
|
|||||||
return Some(Err(err));
|
return Some(Err(err));
|
||||||
};
|
};
|
||||||
|
|
||||||
let last_monitor_time = self.push_stage_helper().last_monitor_time;
|
if let Err(err) = shared_state
|
||||||
|
.event_mgr
|
||||||
let new_monitor_time = match shared_state.event_mgr.maybe_report_progress(
|
.maybe_report_progress(&mut shared_state.state, STATS_TIMEOUT_DEFAULT)
|
||||||
&mut shared_state.state,
|
{
|
||||||
last_monitor_time,
|
|
||||||
STATS_TIMEOUT_DEFAULT,
|
|
||||||
) {
|
|
||||||
Ok(new_time) => new_time,
|
|
||||||
Err(err) => {
|
|
||||||
self.push_stage_helper_mut().end_of_iter(shared_state, true);
|
self.push_stage_helper_mut().end_of_iter(shared_state, true);
|
||||||
return Some(Err(err));
|
return Some(Err(err));
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
self.push_stage_helper_mut().last_monitor_time = new_monitor_time;
|
|
||||||
//self.fuzzer.maybe_report_monitor();
|
|
||||||
} else {
|
} else {
|
||||||
self.push_stage_helper_mut().reset_exit_kind();
|
self.push_stage_helper_mut().reset_exit_kind();
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,9 @@ use crate::{
|
|||||||
observers::ObserversTuple,
|
observers::ObserversTuple,
|
||||||
schedulers::Scheduler,
|
schedulers::Scheduler,
|
||||||
start_timer,
|
start_timer,
|
||||||
state::{HasClientPerfMonitor, HasCorpus, HasExecutions, HasMetadata, HasRand},
|
state::{
|
||||||
|
HasClientPerfMonitor, HasCorpus, HasExecutions, HasLastReportTime, HasMetadata, HasRand,
|
||||||
|
},
|
||||||
Error, EvaluatorObservers, ExecutionProcessor, HasScheduler,
|
Error, EvaluatorObservers, ExecutionProcessor, HasScheduler,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -88,8 +90,14 @@ where
|
|||||||
EM: EventFirer<State = CS::State> + EventRestarter + HasEventManagerId + ProgressReporter,
|
EM: EventFirer<State = CS::State> + EventRestarter + HasEventManagerId + ProgressReporter,
|
||||||
M: Mutator<CS::Input, CS::State>,
|
M: Mutator<CS::Input, CS::State>,
|
||||||
OT: ObserversTuple<CS::State>,
|
OT: ObserversTuple<CS::State>,
|
||||||
CS::State:
|
CS::State: HasClientPerfMonitor
|
||||||
HasClientPerfMonitor + HasCorpus + HasRand + HasExecutions + HasMetadata + Clone + Debug,
|
+ HasCorpus
|
||||||
|
+ HasRand
|
||||||
|
+ HasExecutions
|
||||||
|
+ HasLastReportTime
|
||||||
|
+ HasMetadata
|
||||||
|
+ Clone
|
||||||
|
+ Debug,
|
||||||
Z: ExecutionProcessor<OT, State = CS::State>
|
Z: ExecutionProcessor<OT, State = CS::State>
|
||||||
+ EvaluatorObservers<OT>
|
+ EvaluatorObservers<OT>
|
||||||
+ HasScheduler<Scheduler = CS>,
|
+ HasScheduler<Scheduler = CS>,
|
||||||
@ -202,8 +210,14 @@ where
|
|||||||
EM: EventFirer + EventRestarter + HasEventManagerId + ProgressReporter<State = CS::State>,
|
EM: EventFirer + EventRestarter + HasEventManagerId + ProgressReporter<State = CS::State>,
|
||||||
M: Mutator<CS::Input, CS::State>,
|
M: Mutator<CS::Input, CS::State>,
|
||||||
OT: ObserversTuple<CS::State>,
|
OT: ObserversTuple<CS::State>,
|
||||||
CS::State:
|
CS::State: HasClientPerfMonitor
|
||||||
HasClientPerfMonitor + HasCorpus + HasRand + HasExecutions + HasMetadata + Clone + Debug,
|
+ HasCorpus
|
||||||
|
+ HasRand
|
||||||
|
+ HasExecutions
|
||||||
|
+ HasMetadata
|
||||||
|
+ HasLastReportTime
|
||||||
|
+ Clone
|
||||||
|
+ Debug,
|
||||||
Z: ExecutionProcessor<OT, State = CS::State>
|
Z: ExecutionProcessor<OT, State = CS::State>
|
||||||
+ EvaluatorObservers<OT>
|
+ EvaluatorObservers<OT>
|
||||||
+ HasScheduler<Scheduler = CS>,
|
+ HasScheduler<Scheduler = CS>,
|
||||||
|
@ -219,6 +219,17 @@ pub trait HasStartTime {
|
|||||||
fn start_time_mut(&mut self) -> &mut Duration;
|
fn start_time_mut(&mut self) -> &mut Duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Trait for the last report time, the last time this node reported progress
|
||||||
|
pub trait HasLastReportTime {
|
||||||
|
/// The last time we reported progress,if available/used.
|
||||||
|
/// This information is used by fuzzer `maybe_report_progress`.
|
||||||
|
fn last_report_time(&self) -> &Option<Duration>;
|
||||||
|
|
||||||
|
/// The last time we reported progress,if available/used (mutable).
|
||||||
|
/// This information is used by fuzzer `maybe_report_progress`.
|
||||||
|
fn last_report_time_mut(&mut self) -> &mut Option<Duration>;
|
||||||
|
}
|
||||||
|
|
||||||
/// The state a fuzz run.
|
/// The state a fuzz run.
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||||
#[serde(bound = "
|
#[serde(bound = "
|
||||||
@ -249,6 +260,9 @@ pub struct StdState<I, C, R, SC> {
|
|||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
/// Remaining initial inputs to load, if any
|
/// Remaining initial inputs to load, if any
|
||||||
remaining_initial_files: Option<Vec<PathBuf>>,
|
remaining_initial_files: Option<Vec<PathBuf>>,
|
||||||
|
/// The last time we reported progress (if available/used).
|
||||||
|
/// This information is used by fuzzer `maybe_report_progress`.
|
||||||
|
last_report_time: Option<Duration>,
|
||||||
phantom: PhantomData<I>,
|
phantom: PhantomData<I>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -390,6 +404,20 @@ impl<I, C, R, SC> HasExecutions for StdState<I, C, R, SC> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<I, C, R, SC> HasLastReportTime for StdState<I, C, R, SC> {
|
||||||
|
/// The last time we reported progress,if available/used.
|
||||||
|
/// This information is used by fuzzer `maybe_report_progress`.
|
||||||
|
fn last_report_time(&self) -> &Option<Duration> {
|
||||||
|
&self.last_report_time
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The last time we reported progress,if available/used (mutable).
|
||||||
|
/// This information is used by fuzzer `maybe_report_progress`.
|
||||||
|
fn last_report_time_mut(&mut self) -> &mut Option<Duration> {
|
||||||
|
&mut self.last_report_time
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<I, C, R, SC> HasMaxSize for StdState<I, C, R, SC> {
|
impl<I, C, R, SC> HasMaxSize for StdState<I, C, R, SC> {
|
||||||
fn max_size(&self) -> usize {
|
fn max_size(&self) -> usize {
|
||||||
self.max_size
|
self.max_size
|
||||||
@ -769,6 +797,7 @@ where
|
|||||||
introspection_monitor: ClientPerfMonitor::new(),
|
introspection_monitor: ClientPerfMonitor::new(),
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
remaining_initial_files: None,
|
remaining_initial_files: None,
|
||||||
|
last_report_time: None,
|
||||||
phantom: PhantomData,
|
phantom: PhantomData,
|
||||||
};
|
};
|
||||||
feedback.init_state(&mut state)?;
|
feedback.init_state(&mut state)?;
|
||||||
@ -832,11 +861,22 @@ where
|
|||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
impl<I> HasExecutions for NopState<I> {
|
impl<I> HasExecutions for NopState<I> {
|
||||||
fn executions(&self) -> &usize {
|
fn executions(&self) -> &usize {
|
||||||
unimplemented!()
|
unimplemented!();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn executions_mut(&mut self) -> &mut usize {
|
fn executions_mut(&mut self) -> &mut usize {
|
||||||
unimplemented!()
|
unimplemented!();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
impl<I> HasLastReportTime for NopState<I> {
|
||||||
|
fn last_report_time(&self) -> &Option<Duration> {
|
||||||
|
unimplemented!();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn last_report_time_mut(&mut self) -> &mut Option<Duration> {
|
||||||
|
unimplemented!();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
//! This is a 'meta-package' for libafl that exposes a consistent URL and commit hash for the
|
//! This is a 'meta-package' for libafl that exposes a consistent URL and commit hash for the
|
||||||
//! [`SymCC` fork](https://github.com/AFLplusplus/symcc).
|
//! [`SymCC` fork](https://github.com/AFLplusplus/symcc).
|
||||||
|
#![allow(clippy::module_name_repetitions)]
|
||||||
|
|
||||||
/// The URL of the `LibAFL` `SymCC` fork.
|
/// The URL of the `LibAFL` `SymCC` fork.
|
||||||
pub const SYMCC_REPO_URL: &str = "https://github.com/AFLplusplus/symcc.git";
|
pub const SYMCC_REPO_URL: &str = "https://github.com/AFLplusplus/symcc.git";
|
||||||
|
@ -191,6 +191,7 @@ where
|
|||||||
fn register_location_on_hitmap(&mut self, location: usize) {
|
fn register_location_on_hitmap(&mut self, location: usize) {
|
||||||
let mut hasher = self.build_hasher.build_hasher();
|
let mut hasher = self.build_hasher.build_hasher();
|
||||||
location.hash(&mut hasher);
|
location.hash(&mut hasher);
|
||||||
|
#[allow(clippy::cast_possible_truncation)] // we cannot have more than usize elements..
|
||||||
let hash = (hasher.finish() % usize::MAX as u64) as usize;
|
let hash = (hasher.finish() % usize::MAX as u64) as usize;
|
||||||
let val = unsafe {
|
let val = unsafe {
|
||||||
// SAFETY: the index is modulo by the length, therefore it is always in bounds
|
// SAFETY: the index is modulo by the length, therefore it is always in bounds
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
//! # SymCC and SymQEMU expect to runtime file to be called `libSymRuntime.so`. Setting the name to `SymRuntime` achieves this.
|
//! # SymCC and SymQEMU expect to runtime file to be called `libSymRuntime.so`. Setting the name to `SymRuntime` achieves this.
|
||||||
//! name = "SymRuntime"
|
//! name = "SymRuntime"
|
||||||
//! ```
|
//! ```
|
||||||
|
#![allow(clippy::module_name_repetitions, clippy::missing_panics_doc)]
|
||||||
pub mod filter;
|
pub mod filter;
|
||||||
pub mod tracing;
|
pub mod tracing;
|
||||||
|
|
||||||
|
@ -61,7 +61,13 @@ where
|
|||||||
) -> Result<ExitKind, Error> {
|
) -> Result<ExitKind, Error> {
|
||||||
let input_owned = input.target_bytes();
|
let input_owned = input.target_bytes();
|
||||||
let input = input_owned.as_slice();
|
let input = input_owned.as_slice();
|
||||||
self.helper.nyx_process.set_input(input, input.len() as u32);
|
self.helper.nyx_process.set_input(
|
||||||
|
input,
|
||||||
|
input
|
||||||
|
.len()
|
||||||
|
.try_into()
|
||||||
|
.expect("Inputs larger than 4GB not supported"),
|
||||||
|
);
|
||||||
|
|
||||||
// exec will take care of trace_bits, so no need to reset
|
// exec will take care of trace_bits, so no need to reset
|
||||||
let ret_val = self.helper.nyx_process.exec();
|
let ret_val = self.helper.nyx_process.exec();
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#![allow(clippy::module_name_repetitions, clippy::missing_panics_doc)]
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
pub mod executor;
|
pub mod executor;
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
|
@ -16,7 +16,7 @@ fn build_dep_check(tools: &[&str]) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines, clippy::missing_panics_doc)]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn build(
|
pub fn build(
|
||||||
cpu_target: &str,
|
cpu_target: &str,
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#![allow(clippy::missing_panics_doc)]
|
||||||
use std::{
|
use std::{
|
||||||
fs,
|
fs,
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
|
@ -13,7 +13,10 @@ use libafl::{
|
|||||||
fuzzer::{HasFeedback, HasObjective, HasScheduler},
|
fuzzer::{HasFeedback, HasObjective, HasScheduler},
|
||||||
inputs::UsesInput,
|
inputs::UsesInput,
|
||||||
observers::{ObserversTuple, UsesObservers},
|
observers::{ObserversTuple, UsesObservers},
|
||||||
state::{HasClientPerfMonitor, HasCorpus, HasExecutions, HasSolutions, State, UsesState},
|
state::{
|
||||||
|
HasClientPerfMonitor, HasCorpus, HasExecutions, HasLastReportTime, HasSolutions, State,
|
||||||
|
UsesState,
|
||||||
|
},
|
||||||
Error,
|
Error,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -269,7 +272,7 @@ impl<'a, EM, H, OT, QT, S, Z, SP> Executor<EM, Z> for QemuForkExecutor<'a, H, OT
|
|||||||
where
|
where
|
||||||
EM: EventManager<InProcessForkExecutor<'a, H, OT, S, SP>, Z, State = S>,
|
EM: EventManager<InProcessForkExecutor<'a, H, OT, S, SP>, Z, State = S>,
|
||||||
H: FnMut(&S::Input) -> ExitKind,
|
H: FnMut(&S::Input) -> ExitKind,
|
||||||
S: UsesInput + HasClientPerfMonitor + HasMetadata + HasExecutions,
|
S: UsesInput + HasClientPerfMonitor + HasMetadata + HasExecutions + HasLastReportTime,
|
||||||
OT: ObserversTuple<S>,
|
OT: ObserversTuple<S>,
|
||||||
QT: QemuHelperTuple<S>,
|
QT: QemuHelperTuple<S>,
|
||||||
SP: ShMemProvider,
|
SP: ShMemProvider,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user