Skip to content

Commit bf4ecd1

Browse files
committed
a
1 parent 52562e5 commit bf4ecd1

28 files changed

+201
-274
lines changed

libafl/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ all-features = true
1717
rustc-args = ["--cfg", "docsrs"]
1818

1919
[features]
20-
default = ["std", "derive", "llmp_compression", "llmp_small_maps", "llmp_broker_timeouts", "rand_trait", "fork", "prelude", "gzip", "regex", "serdeany_autoreg", "tui_monitor", "libafl_bolts/xxh3"]
20+
default = ["introspection", "std", "derive", "llmp_compression", "llmp_small_maps", "llmp_broker_timeouts", "rand_trait", "fork", "prelude", "gzip", "regex", "serdeany_autoreg", "tui_monitor", "libafl_bolts/xxh3"]
2121
document-features = ["dep:document-features"]
2222

2323
#! # Feature Flags

libafl/src/events/centralized.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ use crate::{
2929
fuzzer::{EvaluatorObservers, ExecutionProcessor},
3030
inputs::{Input, UsesInput},
3131
observers::ObserversTuple,
32-
state::{
33-
HasClientPerfMonitor, HasExecutions, HasLastReportTime, HasMetadata, HasScalabilityMonitor,
34-
UsesState,
35-
},
32+
state::{HasExecutions, HasLastReportTime, HasMetadata, HasScalabilityMonitor, UsesState},
3633
Error,
3734
};
3835

@@ -421,11 +418,7 @@ where
421418
impl<E, EM, SP, Z> EventManager<E, Z> for CentralizedEventManager<EM, SP>
422419
where
423420
EM: EventStatsCollector + EventManager<E, Z>,
424-
EM::State: HasClientPerfMonitor
425-
+ HasExecutions
426-
+ HasMetadata
427-
+ HasLastReportTime
428-
+ HasScalabilityMonitor,
421+
EM::State: HasExecutions + HasMetadata + HasLastReportTime + HasScalabilityMonitor,
429422
E: HasObservers<State = Self::State> + Executor<Self, Z>,
430423
for<'a> E::Observers: Deserialize<'a>,
431424
Z: EvaluatorObservers<E::Observers, State = Self::State>
@@ -453,7 +446,7 @@ where
453446
impl<EM, SP> ProgressReporter for CentralizedEventManager<EM, SP>
454447
where
455448
EM: EventStatsCollector + ProgressReporter + HasEventManagerId,
456-
EM::State: HasClientPerfMonitor + HasMetadata + HasExecutions + HasLastReportTime,
449+
EM::State: HasMetadata + HasExecutions + HasLastReportTime,
457450
SP: ShMemProvider + 'static,
458451
{
459452
}

libafl/src/events/launcher.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ use crate::inputs::UsesInput;
4949
use crate::{
5050
events::{EventConfig, LlmpRestartingEventManager, ManagerKind, RestartingMgr},
5151
monitors::Monitor,
52-
state::{HasClientPerfMonitor, HasExecutions},
52+
state::HasExecutions,
5353
Error,
5454
};
5555

@@ -141,7 +141,7 @@ impl<'a, CF, MT, S, SP> Launcher<'a, CF, MT, S, SP>
141141
where
142142
CF: FnOnce(Option<S>, LlmpRestartingEventManager<S, SP>, CoreId) -> Result<(), Error>,
143143
MT: Monitor + Clone,
144-
S: DeserializeOwned + UsesInput + HasExecutions + HasClientPerfMonitor,
144+
S: DeserializeOwned + UsesInput + HasExecutions,
145145
SP: ShMemProvider + 'static,
146146
{
147147
/// Launch the broker and the clients and fuzz
@@ -478,7 +478,7 @@ where
478478
CoreId,
479479
) -> Result<(), Error>,
480480
MT: Monitor + Clone,
481-
S: DeserializeOwned + UsesInput + HasExecutions + HasClientPerfMonitor,
481+
S: DeserializeOwned + UsesInput + HasExecutions,
482482
SP: ShMemProvider + 'static,
483483
{
484484
/// Launch the broker and the clients and fuzz

libafl/src/events/llmp.rs

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ use crate::{
5252
inputs::{Input, InputConverter, UsesInput},
5353
monitors::Monitor,
5454
observers::ObserversTuple,
55-
state::{
56-
HasClientPerfMonitor, HasExecutions, HasLastReportTime, HasMetadata, HasScalabilityMonitor,
57-
UsesState,
58-
},
55+
state::{HasExecutions, HasLastReportTime, HasMetadata, HasScalabilityMonitor, UsesState},
5956
Error,
6057
};
6158

@@ -552,7 +549,7 @@ where
552549

553550
impl<S, SP> LlmpEventManager<S, SP>
554551
where
555-
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata,
552+
S: UsesInput + HasExecutions + HasMetadata,
556553
SP: ShMemProvider + 'static,
557554
{
558555
// Handle arriving events in the client
@@ -756,7 +753,7 @@ where
756753

757754
impl<E, S, SP, Z> EventProcessor<E, Z> for LlmpEventManager<S, SP>
758755
where
759-
S: UsesInput + HasClientPerfMonitor + HasExecutions + HasMetadata + HasScalabilityMonitor,
756+
S: UsesInput + HasExecutions + HasMetadata + HasScalabilityMonitor,
760757
SP: ShMemProvider,
761758
E: HasObservers<State = S> + Executor<Self, Z>,
762759
for<'a> E::Observers: Deserialize<'a>,
@@ -803,12 +800,7 @@ impl<E, S, SP, Z> EventManager<E, Z> for LlmpEventManager<S, SP>
803800
where
804801
E: HasObservers<State = S> + Executor<Self, Z>,
805802
for<'a> E::Observers: Deserialize<'a>,
806-
S: UsesInput
807-
+ HasExecutions
808-
+ HasClientPerfMonitor
809-
+ HasMetadata
810-
+ HasLastReportTime
811-
+ HasScalabilityMonitor,
803+
S: UsesInput + HasExecutions + HasMetadata + HasLastReportTime + HasScalabilityMonitor,
812804
SP: ShMemProvider,
813805
Z: EvaluatorObservers<E::Observers, State = S> + ExecutionProcessor<E::Observers, State = S>,
814806
{
@@ -829,7 +821,7 @@ where
829821

830822
impl<S, SP> ProgressReporter for LlmpEventManager<S, SP>
831823
where
832-
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata + HasLastReportTime,
824+
S: UsesInput + HasExecutions + HasMetadata + HasLastReportTime,
833825
SP: ShMemProvider,
834826
{
835827
}
@@ -915,12 +907,7 @@ where
915907
#[cfg(feature = "std")]
916908
impl<S, SP> ProgressReporter for LlmpRestartingEventManager<S, SP>
917909
where
918-
S: UsesInput
919-
+ HasExecutions
920-
+ HasClientPerfMonitor
921-
+ HasMetadata
922-
+ HasLastReportTime
923-
+ Serialize,
910+
S: UsesInput + HasExecutions + HasMetadata + HasLastReportTime + Serialize,
924911
SP: ShMemProvider,
925912
{
926913
}
@@ -956,7 +943,7 @@ where
956943
#[cfg(feature = "std")]
957944
impl<S, SP> EventRestarter for LlmpRestartingEventManager<S, SP>
958945
where
959-
S: UsesInput + HasExecutions + HasClientPerfMonitor + Serialize,
946+
S: UsesInput + HasExecutions + Serialize,
960947
SP: ShMemProvider,
961948
//CE: CustomEvent<I>,
962949
{
@@ -994,7 +981,7 @@ impl<E, S, SP, Z> EventProcessor<E, Z> for LlmpRestartingEventManager<S, SP>
994981
where
995982
E: HasObservers<State = S> + Executor<LlmpEventManager<S, SP>, Z>,
996983
for<'a> E::Observers: Deserialize<'a>,
997-
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata + HasScalabilityMonitor,
984+
S: UsesInput + HasExecutions + HasMetadata + HasScalabilityMonitor,
998985
SP: ShMemProvider + 'static,
999986
Z: EvaluatorObservers<E::Observers, State = S> + ExecutionProcessor<E::Observers>, //CE: CustomEvent<I>,
1000987
{
@@ -1010,7 +997,6 @@ where
1010997
for<'a> E::Observers: Deserialize<'a>,
1011998
S: UsesInput
1012999
+ HasExecutions
1013-
+ HasClientPerfMonitor
10141000
+ HasScalabilityMonitor
10151001
+ HasMetadata
10161002
+ HasLastReportTime
@@ -1104,7 +1090,7 @@ pub fn setup_restarting_mgr_std<MT, S>(
11041090
) -> Result<(Option<S>, LlmpRestartingEventManager<S, StdShMemProvider>), Error>
11051091
where
11061092
MT: Monitor + Clone,
1107-
S: DeserializeOwned + UsesInput + HasClientPerfMonitor + HasExecutions,
1093+
S: DeserializeOwned + UsesInput + HasExecutions,
11081094
{
11091095
RestartingMgr::builder()
11101096
.shmem_provider(StdShMemProvider::new()?)
@@ -1165,7 +1151,7 @@ where
11651151
impl<MT, S, SP> RestartingMgr<MT, S, SP>
11661152
where
11671153
SP: ShMemProvider,
1168-
S: UsesInput + HasExecutions + HasClientPerfMonitor + DeserializeOwned,
1154+
S: UsesInput + HasExecutions + DeserializeOwned,
11691155
MT: Monitor + Clone,
11701156
{
11711157
/// Launch the restarting manager
@@ -1429,7 +1415,7 @@ where
14291415

14301416
impl<IC, ICB, DI, S, SP> LlmpEventConverter<IC, ICB, DI, S, SP>
14311417
where
1432-
S: UsesInput + HasExecutions + HasClientPerfMonitor,
1418+
S: UsesInput + HasExecutions,
14331419
SP: ShMemProvider + 'static,
14341420
IC: InputConverter<From = S::Input, To = DI>,
14351421
ICB: InputConverter<From = DI, To = S::Input>,

libafl/src/events/mod.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,14 @@ use serde::{Deserialize, Serialize};
3838
#[cfg(feature = "std")]
3939
use uuid::Uuid;
4040

41+
#[cfg(feature = "introspection")]
42+
use crate::state::HasClientPerfMonitor;
4143
use crate::{
4244
executors::ExitKind,
4345
inputs::Input,
4446
monitors::UserStats,
4547
observers::ObserversTuple,
46-
state::{HasClientPerfMonitor, HasExecutions, HasLastReportTime, HasMetadata},
48+
state::{HasExecutions, HasLastReportTime, HasMetadata},
4749
Error,
4850
};
4951

@@ -462,7 +464,7 @@ pub trait EventFirer: UsesState {
462464
/// [`ProgressReporter`] report progress to the broker.
463465
pub trait ProgressReporter: EventFirer
464466
where
465-
Self::State: HasClientPerfMonitor + HasMetadata + HasExecutions + HasLastReportTime,
467+
Self::State: HasMetadata + HasExecutions + HasLastReportTime,
466468
{
467469
/// Given the last time, if `monitor_timeout` seconds passed, send off an info/monitor/heartbeat message to the broker.
468470
/// Returns the new `last` time (so the old one, unless `monitor_timeout` time has passed and monitor have been sent)
@@ -574,7 +576,7 @@ pub trait HasEventManagerId {
574576
pub trait EventManager<E, Z>:
575577
EventFirer + EventProcessor<E, Z> + EventRestarter + HasEventManagerId + ProgressReporter
576578
where
577-
Self::State: HasClientPerfMonitor + HasMetadata + HasExecutions + HasLastReportTime,
579+
Self::State: HasMetadata + HasExecutions + HasLastReportTime,
578580
{
579581
}
580582

@@ -628,7 +630,7 @@ impl<S> EventRestarter for NopEventManager<S> where S: UsesInput {}
628630

629631
impl<E, S, Z> EventProcessor<E, Z> for NopEventManager<S>
630632
where
631-
S: UsesInput + HasClientPerfMonitor + HasExecutions,
633+
S: UsesInput + HasExecutions,
632634
{
633635
fn process(
634636
&mut self,
@@ -641,7 +643,7 @@ where
641643
}
642644

643645
impl<E, S, Z> EventManager<E, Z> for NopEventManager<S> where
644-
S: UsesInput + HasClientPerfMonitor + HasExecutions + HasLastReportTime + HasMetadata
646+
S: UsesInput + HasExecutions + HasLastReportTime + HasMetadata
645647
{
646648
}
647649

@@ -659,7 +661,7 @@ where
659661
}
660662

661663
impl<S> ProgressReporter for NopEventManager<S> where
662-
S: UsesInput + HasClientPerfMonitor + HasExecutions + HasLastReportTime + HasMetadata
664+
S: UsesInput + HasExecutions + HasLastReportTime + HasMetadata
663665
{
664666
}
665667

libafl/src/events/simple.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use crate::{
3838
},
3939
inputs::UsesInput,
4040
monitors::Monitor,
41-
state::{HasClientPerfMonitor, HasExecutions, HasLastReportTime, HasMetadata, UsesState},
41+
state::{HasExecutions, HasLastReportTime, HasMetadata, UsesState},
4242
Error,
4343
};
4444
#[cfg(feature = "std")]
@@ -135,7 +135,7 @@ where
135135
impl<E, MT, S, Z> EventManager<E, Z> for SimpleEventManager<MT, S>
136136
where
137137
MT: Monitor,
138-
S: UsesInput + HasClientPerfMonitor + HasExecutions + HasLastReportTime + HasMetadata,
138+
S: UsesInput + HasExecutions + HasLastReportTime + HasMetadata,
139139
{
140140
}
141141

@@ -158,7 +158,7 @@ where
158158
impl<MT, S> ProgressReporter for SimpleEventManager<MT, S>
159159
where
160160
MT: Monitor,
161-
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata + HasLastReportTime,
161+
S: UsesInput + HasExecutions + HasMetadata + HasLastReportTime,
162162
{
163163
}
164164

@@ -370,7 +370,7 @@ where
370370
impl<E, MT, S, SP, Z> EventProcessor<E, Z> for SimpleRestartingEventManager<MT, S, SP>
371371
where
372372
MT: Monitor,
373-
S: UsesInput + HasClientPerfMonitor + HasExecutions + Serialize,
373+
S: UsesInput + HasExecutions + Serialize,
374374
SP: ShMemProvider,
375375
{
376376
fn process(
@@ -387,12 +387,7 @@ where
387387
impl<E, MT, S, SP, Z> EventManager<E, Z> for SimpleRestartingEventManager<MT, S, SP>
388388
where
389389
MT: Monitor,
390-
S: UsesInput
391-
+ HasExecutions
392-
+ HasClientPerfMonitor
393-
+ HasMetadata
394-
+ HasLastReportTime
395-
+ Serialize,
390+
S: UsesInput + HasExecutions + HasMetadata + HasLastReportTime + Serialize,
396391
SP: ShMemProvider,
397392
{
398393
}
@@ -416,7 +411,7 @@ where
416411
impl<MT, S, SP> ProgressReporter for SimpleRestartingEventManager<MT, S, SP>
417412
where
418413
MT: Monitor,
419-
S: UsesInput + HasExecutions + HasClientPerfMonitor + HasMetadata + HasLastReportTime,
414+
S: UsesInput + HasExecutions + HasMetadata + HasLastReportTime,
420415
SP: ShMemProvider,
421416
{
422417
}

libafl/src/executors/inprocess.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ use crate::{
5353
fuzzer::HasObjective,
5454
inputs::UsesInput,
5555
observers::{ObserversTuple, UsesObservers},
56-
state::{HasClientPerfMonitor, HasCorpus, HasExecutions, HasSolutions, UsesState},
56+
state::{HasCorpus, HasExecutions, HasSolutions, UsesState},
5757
Error,
5858
};
5959

@@ -171,7 +171,7 @@ where
171171
H: FnMut(&<S as UsesInput>::Input) -> ExitKind + ?Sized,
172172
HB: BorrowMut<H>,
173173
OT: ObserversTuple<S>,
174-
S: HasExecutions + HasSolutions + HasClientPerfMonitor + HasCorpus,
174+
S: HasExecutions + HasSolutions + HasCorpus,
175175
{
176176
/// Create a new in mem executor.
177177
/// Caution: crash and restart in one of them will lead to odd behavior if multiple are used,
@@ -350,7 +350,7 @@ impl InProcessHandlers {
350350
E: Executor<EM, Z> + HasObservers,
351351
EM: EventFirer<State = E::State> + EventRestarter<State = E::State>,
352352
OF: Feedback<E::State>,
353-
E::State: HasExecutions + HasSolutions + HasClientPerfMonitor + HasCorpus,
353+
E::State: HasExecutions + HasSolutions + HasCorpus,
354354
Z: HasObjective<Objective = OF, State = E::State>,
355355
{
356356
#[cfg(unix)]
@@ -591,7 +591,7 @@ pub fn run_observers_and_save_state<E, EM, OF, Z>(
591591
E: HasObservers,
592592
EM: EventFirer<State = E::State> + EventRestarter<State = E::State>,
593593
OF: Feedback<E::State>,
594-
E::State: HasExecutions + HasSolutions + HasClientPerfMonitor + HasCorpus,
594+
E::State: HasExecutions + HasSolutions + HasCorpus,
595595
Z: HasObjective<Objective = OF, State = E::State>,
596596
{
597597
let observers = executor.observers_mut();
@@ -657,7 +657,7 @@ pub mod unix_signal_handler {
657657
feedbacks::Feedback,
658658
fuzzer::HasObjective,
659659
inputs::UsesInput,
660-
state::{HasClientPerfMonitor, HasCorpus, HasExecutions, HasSolutions},
660+
state::{HasCorpus, HasExecutions, HasSolutions},
661661
};
662662

663663
pub(crate) type HandlerFuncPtr = unsafe fn(
@@ -727,7 +727,7 @@ pub mod unix_signal_handler {
727727
E: HasObservers,
728728
EM: EventFirer<State = E::State> + EventRestarter<State = E::State>,
729729
OF: Feedback<E::State>,
730-
E::State: HasExecutions + HasSolutions + HasClientPerfMonitor + HasCorpus,
730+
E::State: HasExecutions + HasSolutions + HasCorpus,
731731
Z: HasObjective<Objective = OF, State = E::State>,
732732
{
733733
let old_hook = panic::take_hook();
@@ -775,7 +775,7 @@ pub mod unix_signal_handler {
775775
E: HasObservers,
776776
EM: EventFirer<State = E::State> + EventRestarter<State = E::State>,
777777
OF: Feedback<E::State>,
778-
E::State: HasExecutions + HasSolutions + HasClientPerfMonitor + HasCorpus,
778+
E::State: HasExecutions + HasSolutions + HasCorpus,
779779
Z: HasObjective<Objective = OF, State = E::State>,
780780
{
781781
if !data.timeout_executor_ptr.is_null()
@@ -825,7 +825,7 @@ pub mod unix_signal_handler {
825825
E: Executor<EM, Z> + HasObservers,
826826
EM: EventFirer<State = E::State> + EventRestarter<State = E::State>,
827827
OF: Feedback<E::State>,
828-
E::State: HasExecutions + HasSolutions + HasClientPerfMonitor + HasCorpus,
828+
E::State: HasExecutions + HasSolutions + HasCorpus,
829829
Z: HasObjective<Objective = OF, State = E::State>,
830830
{
831831
#[cfg(all(target_os = "android", target_arch = "aarch64"))]
@@ -1856,7 +1856,7 @@ where
18561856
where
18571857
EM: EventFirer<State = S> + EventRestarter,
18581858
OF: Feedback<S>,
1859-
S: HasSolutions + HasClientPerfMonitor,
1859+
S: HasSolutions,
18601860
Z: HasObjective<Objective = OF, State = S>,
18611861
{
18621862
let handlers = InChildProcessHandlers::new::<Self>()?;
@@ -1904,7 +1904,7 @@ where
19041904
where
19051905
EM: EventFirer<State = S> + EventRestarter<State = S>,
19061906
OF: Feedback<S>,
1907-
S: HasSolutions + HasClientPerfMonitor,
1907+
S: HasSolutions,
19081908
Z: HasObjective<Objective = OF, State = S>,
19091909
{
19101910
let handlers = InChildProcessHandlers::with_timeout::<Self>()?;

0 commit comments

Comments
 (0)