* 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},
|
||||
inputs::UsesInput,
|
||||
observers::ObserversTuple,
|
||||
state::{HasClientPerfMonitor, HasExecutions, HasMetadata, UsesState},
|
||||
state::{HasClientPerfMonitor, HasExecutions, HasLastReportTime, HasMetadata, UsesState},
|
||||
Error,
|
||||
};
|
||||
|
||||
@ -324,7 +324,7 @@ where
|
||||
impl<E, EM, SP, Z> EventManager<E, Z> for CentralizedEventManager<EM, SP>
|
||||
where
|
||||
EM: EventStatsCollector + EventManager<E, Z>,
|
||||
EM::State: HasClientPerfMonitor + HasExecutions + HasMetadata,
|
||||
EM::State: HasClientPerfMonitor + HasExecutions + HasMetadata + HasLastReportTime,
|
||||
SP: ShMemProvider,
|
||||
E: HasObservers<State = Self::State> + Executor<Self, Z>,
|
||||
for<'a> E::Observers: Deserialize<'a>,
|
||||
@ -352,7 +352,7 @@ where
|
||||
impl<EM, SP> ProgressReporter for CentralizedEventManager<EM, SP>
|
||||
where
|
||||
EM: EventStatsCollector + ProgressReporter + HasEventManagerId,
|
||||
EM::State: HasClientPerfMonitor + HasMetadata + HasExecutions,
|
||||
EM::State: HasClientPerfMonitor + HasMetadata + HasExecutions + HasLastReportTime,
|
||||
SP: ShMemProvider,
|
||||
{
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ use crate::{
|
||||
inputs::{Input, InputConverter, UsesInput},
|
||||
monitors::Monitor,
|
||||
observers::ObserversTuple,
|
||||
state::{HasClientPerfMonitor, HasExecutions, HasMetadata, UsesState},
|
||||
state::{HasClientPerfMonitor, HasExecutions, HasLastReportTime, HasMetadata, UsesState},
|
||||
Error,
|
||||
};
|
||||
|
||||
@ -788,7 +788,7 @@ impl<E, S, SP, Z> EventManager<E, Z> for LlmpEventManager<S, SP>
|
||||
where
|
||||
E: HasObservers<State = S> + Executor<Self, Z>,
|
||||
for<'a> E::Observers: Deserialize<'a>,
|
||||
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata,
|
||||
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata + HasLastReportTime,
|
||||
SP: ShMemProvider,
|
||||
Z: EvaluatorObservers<E::Observers, State = S> + ExecutionProcessor<E::Observers, State = S>,
|
||||
{
|
||||
@ -809,7 +809,7 @@ where
|
||||
|
||||
impl<S, SP> ProgressReporter for LlmpEventManager<S, SP>
|
||||
where
|
||||
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata,
|
||||
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata + HasLastReportTime,
|
||||
SP: ShMemProvider,
|
||||
{
|
||||
}
|
||||
@ -895,7 +895,12 @@ where
|
||||
#[cfg(feature = "std")]
|
||||
impl<S, SP> ProgressReporter for LlmpRestartingEventManager<S, SP>
|
||||
where
|
||||
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata + Serialize,
|
||||
S: UsesInput
|
||||
+ HasExecutions
|
||||
+ HasClientPerfMonitor
|
||||
+ HasMetadata
|
||||
+ HasLastReportTime
|
||||
+ Serialize,
|
||||
SP: ShMemProvider,
|
||||
{
|
||||
}
|
||||
@ -979,7 +984,12 @@ impl<E, S, SP, Z> EventManager<E, Z> for LlmpRestartingEventManager<S, SP>
|
||||
where
|
||||
E: HasObservers<State = S> + Executor<LlmpEventManager<S, SP>, Z>,
|
||||
for<'a> E::Observers: Deserialize<'a>,
|
||||
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata + Serialize,
|
||||
S: UsesInput
|
||||
+ HasExecutions
|
||||
+ HasClientPerfMonitor
|
||||
+ HasMetadata
|
||||
+ HasLastReportTime
|
||||
+ Serialize,
|
||||
SP: ShMemProvider + 'static,
|
||||
Z: EvaluatorObservers<E::Observers, State = S> + ExecutionProcessor<E::Observers>, //CE: CustomEvent<I>,
|
||||
{
|
||||
|
@ -34,7 +34,7 @@ use crate::{
|
||||
inputs::Input,
|
||||
monitors::UserStats,
|
||||
observers::ObserversTuple,
|
||||
state::{HasClientPerfMonitor, HasExecutions, HasMetadata},
|
||||
state::{HasClientPerfMonitor, HasExecutions, HasLastReportTime, HasMetadata},
|
||||
Error,
|
||||
};
|
||||
|
||||
@ -451,7 +451,7 @@ pub trait EventFirer: UsesState {
|
||||
/// [`ProgressReporter`] report progress to the broker.
|
||||
pub trait ProgressReporter: EventFirer
|
||||
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.
|
||||
/// 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(
|
||||
&mut self,
|
||||
state: &mut Self::State,
|
||||
last_report_time: 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();
|
||||
// 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)?;
|
||||
|
||||
Ok(cur)
|
||||
} else {
|
||||
Ok(last_report_time)
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Send off an info/monitor/heartbeat message to the broker.
|
||||
@ -510,6 +512,8 @@ where
|
||||
)?;
|
||||
}
|
||||
|
||||
*state.last_report_time_mut() = Some(cur);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@ -558,7 +562,7 @@ pub trait HasEventManagerId {
|
||||
pub trait EventManager<E, Z>:
|
||||
EventFirer + EventProcessor<E, Z> + EventRestarter + HasEventManagerId + ProgressReporter
|
||||
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
|
||||
S: UsesInput + HasClientPerfMonitor + HasExecutions + HasMetadata
|
||||
S: UsesInput + HasClientPerfMonitor + HasExecutions + HasLastReportTime + HasMetadata
|
||||
{
|
||||
}
|
||||
|
||||
@ -643,7 +647,7 @@ 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,
|
||||
monitors::Monitor,
|
||||
state::{HasClientPerfMonitor, HasExecutions, HasMetadata, UsesState},
|
||||
state::{HasClientPerfMonitor, HasExecutions, HasLastReportTime, HasMetadata, UsesState},
|
||||
Error,
|
||||
};
|
||||
#[cfg(feature = "std")]
|
||||
@ -132,7 +132,7 @@ where
|
||||
impl<E, MT, S, Z> EventManager<E, Z> for SimpleEventManager<MT, S>
|
||||
where
|
||||
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>
|
||||
where
|
||||
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>
|
||||
where
|
||||
MT: Monitor,
|
||||
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata + Serialize,
|
||||
S: UsesInput
|
||||
+ HasExecutions
|
||||
+ HasClientPerfMonitor
|
||||
+ HasMetadata
|
||||
+ HasLastReportTime
|
||||
+ Serialize,
|
||||
SP: ShMemProvider,
|
||||
{
|
||||
}
|
||||
@ -403,7 +408,7 @@ where
|
||||
impl<MT, S, SP> ProgressReporter for SimpleRestartingEventManager<MT, S, SP>
|
||||
where
|
||||
MT: Monitor,
|
||||
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata,
|
||||
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata + HasLastReportTime,
|
||||
SP: ShMemProvider,
|
||||
{
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ use crate::{
|
||||
fuzzer::{EvaluatorObservers, ExecutionProcessor},
|
||||
inputs::{Input, UsesInput},
|
||||
monitors::Monitor,
|
||||
state::{HasClientPerfMonitor, HasExecutions, HasMetadata, UsesState},
|
||||
state::{HasClientPerfMonitor, HasExecutions, HasLastReportTime, HasMetadata, UsesState},
|
||||
Error,
|
||||
};
|
||||
|
||||
@ -622,7 +622,7 @@ impl<E, S, Z> EventManager<E, Z> for TcpEventManager<S>
|
||||
where
|
||||
E: HasObservers<State = S> + Executor<Self, Z>,
|
||||
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>,
|
||||
{
|
||||
}
|
||||
@ -640,7 +640,7 @@ 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")]
|
||||
impl<S, SP> ProgressReporter for TcpRestartingEventManager<S, SP>
|
||||
where
|
||||
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata + Serialize,
|
||||
S: UsesInput
|
||||
+ HasExecutions
|
||||
+ HasClientPerfMonitor
|
||||
+ HasMetadata
|
||||
+ HasLastReportTime
|
||||
+ Serialize,
|
||||
SP: ShMemProvider,
|
||||
{
|
||||
}
|
||||
@ -758,7 +763,12 @@ impl<E, S, SP, Z> EventManager<E, Z> for TcpRestartingEventManager<S, SP>
|
||||
where
|
||||
E: HasObservers<State = S> + Executor<TcpEventManager<S>, Z>,
|
||||
for<'a> E::Observers: Deserialize<'a>,
|
||||
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata + Serialize,
|
||||
S: UsesInput
|
||||
+ HasExecutions
|
||||
+ HasClientPerfMonitor
|
||||
+ HasMetadata
|
||||
+ HasLastReportTime
|
||||
+ Serialize,
|
||||
SP: ShMemProvider + 'static,
|
||||
Z: EvaluatorObservers<E::Observers, State = S> + ExecutionProcessor<E::Observers>, //CE: CustomEvent<I>,
|
||||
{
|
||||
|
@ -23,7 +23,10 @@ use crate::{
|
||||
schedulers::Scheduler,
|
||||
stages::StagesTuple,
|
||||
start_timer,
|
||||
state::{HasClientPerfMonitor, HasCorpus, HasExecutions, HasMetadata, HasSolutions, UsesState},
|
||||
state::{
|
||||
HasClientPerfMonitor, HasCorpus, HasExecutions, HasLastReportTime, HasMetadata,
|
||||
HasSolutions, UsesState,
|
||||
},
|
||||
Error,
|
||||
};
|
||||
|
||||
@ -155,7 +158,7 @@ where
|
||||
/// The main fuzzer trait.
|
||||
pub trait Fuzzer<E, EM, ST>: Sized + UsesState
|
||||
where
|
||||
Self::State: HasClientPerfMonitor + HasMetadata + HasExecutions,
|
||||
Self::State: HasClientPerfMonitor + HasMetadata + HasExecutions + HasLastReportTime,
|
||||
E: UsesState<State = Self::State>,
|
||||
EM: ProgressReporter<State = Self::State>,
|
||||
ST: StagesTuple<E, EM, Self::State, Self>,
|
||||
@ -185,11 +188,10 @@ where
|
||||
state: &mut EM::State,
|
||||
manager: &mut EM,
|
||||
) -> Result<CorpusId, Error> {
|
||||
let mut last = current_time();
|
||||
let monitor_timeout = STATS_TIMEOUT_DEFAULT;
|
||||
loop {
|
||||
manager.maybe_report_progress(state, monitor_timeout)?;
|
||||
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 last = current_time();
|
||||
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)?);
|
||||
last = manager.maybe_report_progress(state, last, monitor_timeout)?;
|
||||
}
|
||||
|
||||
manager.report_progress(state)?;
|
||||
@ -575,7 +576,12 @@ where
|
||||
EM: ProgressReporter + EventProcessor<E, Self, State = CS::State>,
|
||||
F: 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>,
|
||||
{
|
||||
fn fuzz_one(
|
||||
|
@ -66,7 +66,10 @@ use crate::{
|
||||
inputs::UsesInput,
|
||||
observers::ObserversTuple,
|
||||
schedulers::Scheduler,
|
||||
state::{HasClientPerfMonitor, HasCorpus, HasExecutions, HasMetadata, HasRand, UsesState},
|
||||
state::{
|
||||
HasClientPerfMonitor, HasCorpus, HasExecutions, HasLastReportTime, HasMetadata, HasRand,
|
||||
UsesState,
|
||||
},
|
||||
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>
|
||||
where
|
||||
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>,
|
||||
EM: EventFirer<State = CS::State>
|
||||
+ EventRestarter
|
||||
|
@ -16,14 +16,15 @@ use core::{
|
||||
pub use mutational::StdMutationalPushStage;
|
||||
|
||||
use crate::{
|
||||
bolts::current_time,
|
||||
corpus::CorpusId,
|
||||
events::{EventFirer, EventRestarter, HasEventManagerId, ProgressReporter},
|
||||
executors::ExitKind,
|
||||
inputs::UsesInput,
|
||||
observers::ObserversTuple,
|
||||
schedulers::Scheduler,
|
||||
state::{HasClientPerfMonitor, HasCorpus, HasExecutions, HasMetadata, HasRand},
|
||||
state::{
|
||||
HasClientPerfMonitor, HasCorpus, HasExecutions, HasLastReportTime, HasMetadata, HasRand,
|
||||
},
|
||||
Error, EvaluatorObservers, ExecutionProcessor, HasScheduler,
|
||||
};
|
||||
|
||||
@ -92,8 +93,6 @@ where
|
||||
/// If this stage has already been initalized.
|
||||
/// This gets reset to `false` after one iteration of the stage is done.
|
||||
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
|
||||
#[allow(clippy::type_complexity)]
|
||||
pub shared_state: Rc<RefCell<Option<PushStageSharedState<CS, EM, OT, Z>>>>,
|
||||
@ -132,7 +131,6 @@ where
|
||||
shared_state,
|
||||
initialized: false,
|
||||
phantom: PhantomData,
|
||||
last_monitor_time: current_time(),
|
||||
exit_kind: exit_kind_ref,
|
||||
errored: false,
|
||||
current_input: None,
|
||||
@ -184,7 +182,12 @@ where
|
||||
pub trait PushStage<CS, EM, OT, Z>: Iterator
|
||||
where
|
||||
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,
|
||||
OT: ObserversTuple<CS::State>,
|
||||
Z: ExecutionProcessor<OT, State = CS::State>
|
||||
@ -307,22 +310,13 @@ where
|
||||
return Some(Err(err));
|
||||
};
|
||||
|
||||
let last_monitor_time = self.push_stage_helper().last_monitor_time;
|
||||
|
||||
let new_monitor_time = match shared_state.event_mgr.maybe_report_progress(
|
||||
&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);
|
||||
return Some(Err(err));
|
||||
}
|
||||
if let Err(err) = shared_state
|
||||
.event_mgr
|
||||
.maybe_report_progress(&mut shared_state.state, STATS_TIMEOUT_DEFAULT)
|
||||
{
|
||||
self.push_stage_helper_mut().end_of_iter(shared_state, true);
|
||||
return Some(Err(err));
|
||||
};
|
||||
|
||||
self.push_stage_helper_mut().last_monitor_time = new_monitor_time;
|
||||
//self.fuzzer.maybe_report_monitor();
|
||||
} else {
|
||||
self.push_stage_helper_mut().reset_exit_kind();
|
||||
}
|
||||
|
@ -21,7 +21,9 @@ use crate::{
|
||||
observers::ObserversTuple,
|
||||
schedulers::Scheduler,
|
||||
start_timer,
|
||||
state::{HasClientPerfMonitor, HasCorpus, HasExecutions, HasMetadata, HasRand},
|
||||
state::{
|
||||
HasClientPerfMonitor, HasCorpus, HasExecutions, HasLastReportTime, HasMetadata, HasRand,
|
||||
},
|
||||
Error, EvaluatorObservers, ExecutionProcessor, HasScheduler,
|
||||
};
|
||||
|
||||
@ -88,8 +90,14 @@ where
|
||||
EM: EventFirer<State = CS::State> + EventRestarter + HasEventManagerId + ProgressReporter,
|
||||
M: Mutator<CS::Input, CS::State>,
|
||||
OT: ObserversTuple<CS::State>,
|
||||
CS::State:
|
||||
HasClientPerfMonitor + HasCorpus + HasRand + HasExecutions + HasMetadata + Clone + Debug,
|
||||
CS::State: HasClientPerfMonitor
|
||||
+ HasCorpus
|
||||
+ HasRand
|
||||
+ HasExecutions
|
||||
+ HasLastReportTime
|
||||
+ HasMetadata
|
||||
+ Clone
|
||||
+ Debug,
|
||||
Z: ExecutionProcessor<OT, State = CS::State>
|
||||
+ EvaluatorObservers<OT>
|
||||
+ HasScheduler<Scheduler = CS>,
|
||||
@ -202,8 +210,14 @@ where
|
||||
EM: EventFirer + EventRestarter + HasEventManagerId + ProgressReporter<State = CS::State>,
|
||||
M: Mutator<CS::Input, CS::State>,
|
||||
OT: ObserversTuple<CS::State>,
|
||||
CS::State:
|
||||
HasClientPerfMonitor + HasCorpus + HasRand + HasExecutions + HasMetadata + Clone + Debug,
|
||||
CS::State: HasClientPerfMonitor
|
||||
+ HasCorpus
|
||||
+ HasRand
|
||||
+ HasExecutions
|
||||
+ HasMetadata
|
||||
+ HasLastReportTime
|
||||
+ Clone
|
||||
+ Debug,
|
||||
Z: ExecutionProcessor<OT, State = CS::State>
|
||||
+ EvaluatorObservers<OT>
|
||||
+ HasScheduler<Scheduler = CS>,
|
||||
|
@ -219,6 +219,17 @@ pub trait HasStartTime {
|
||||
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.
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
#[serde(bound = "
|
||||
@ -249,6 +260,9 @@ pub struct StdState<I, C, R, SC> {
|
||||
#[cfg(feature = "std")]
|
||||
/// Remaining initial inputs to load, if any
|
||||
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>,
|
||||
}
|
||||
|
||||
@ -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> {
|
||||
fn max_size(&self) -> usize {
|
||||
self.max_size
|
||||
@ -769,6 +797,7 @@ where
|
||||
introspection_monitor: ClientPerfMonitor::new(),
|
||||
#[cfg(feature = "std")]
|
||||
remaining_initial_files: None,
|
||||
last_report_time: None,
|
||||
phantom: PhantomData,
|
||||
};
|
||||
feedback.init_state(&mut state)?;
|
||||
@ -832,11 +861,22 @@ where
|
||||
#[cfg(test)]
|
||||
impl<I> HasExecutions for NopState<I> {
|
||||
fn executions(&self) -> &usize {
|
||||
unimplemented!()
|
||||
unimplemented!();
|
||||
}
|
||||
|
||||
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
|
||||
//! [`SymCC` fork](https://github.com/AFLplusplus/symcc).
|
||||
#![allow(clippy::module_name_repetitions)]
|
||||
|
||||
/// The URL of the `LibAFL` `SymCC` fork.
|
||||
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) {
|
||||
let mut hasher = self.build_hasher.build_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 val = unsafe {
|
||||
// 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.
|
||||
//! name = "SymRuntime"
|
||||
//! ```
|
||||
#![allow(clippy::module_name_repetitions, clippy::missing_panics_doc)]
|
||||
pub mod filter;
|
||||
pub mod tracing;
|
||||
|
||||
|
@ -61,7 +61,13 @@ where
|
||||
) -> Result<ExitKind, Error> {
|
||||
let input_owned = input.target_bytes();
|
||||
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
|
||||
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")]
|
||||
pub mod executor;
|
||||
#[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]
|
||||
pub fn build(
|
||||
cpu_target: &str,
|
||||
|
@ -1,3 +1,4 @@
|
||||
#![allow(clippy::missing_panics_doc)]
|
||||
use std::{
|
||||
fs,
|
||||
path::{Path, PathBuf},
|
||||
|
@ -13,7 +13,10 @@ use libafl::{
|
||||
fuzzer::{HasFeedback, HasObjective, HasScheduler},
|
||||
inputs::UsesInput,
|
||||
observers::{ObserversTuple, UsesObservers},
|
||||
state::{HasClientPerfMonitor, HasCorpus, HasExecutions, HasSolutions, State, UsesState},
|
||||
state::{
|
||||
HasClientPerfMonitor, HasCorpus, HasExecutions, HasLastReportTime, HasSolutions, State,
|
||||
UsesState,
|
||||
},
|
||||
Error,
|
||||
};
|
||||
|
||||
@ -269,7 +272,7 @@ impl<'a, EM, H, OT, QT, S, Z, SP> Executor<EM, Z> for QemuForkExecutor<'a, H, OT
|
||||
where
|
||||
EM: EventManager<InProcessForkExecutor<'a, H, OT, S, SP>, Z, State = S>,
|
||||
H: FnMut(&S::Input) -> ExitKind,
|
||||
S: UsesInput + HasClientPerfMonitor + HasMetadata + HasExecutions,
|
||||
S: UsesInput + HasClientPerfMonitor + HasMetadata + HasExecutions + HasLastReportTime,
|
||||
OT: ObserversTuple<S>,
|
||||
QT: QemuHelperTuple<S>,
|
||||
SP: ShMemProvider,
|
||||
|
Loading…
x
Reference in New Issue
Block a user