Skip to content

Commit 6523c60

Browse files
committed
workging?
1 parent 750cd0b commit 6523c60

File tree

30 files changed

+198
-206
lines changed

30 files changed

+198
-206
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 = ["introspection", "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 = ["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/launcher.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,11 @@ use typed_builder::TypedBuilder;
4444

4545
#[cfg(all(unix, feature = "std", feature = "fork"))]
4646
use crate::events::{CentralizedEventManager, CentralizedLlmpEventBroker};
47-
use crate::inputs::UsesInput;
4847
#[cfg(feature = "std")]
4948
use crate::{
5049
events::{EventConfig, LlmpRestartingEventManager, ManagerKind, RestartingMgr},
5150
monitors::Monitor,
52-
state::HasExecutions,
51+
state::{HasExecutions, State},
5352
Error,
5453
};
5554

@@ -76,7 +75,7 @@ where
7675
S::Input: 'a,
7776
MT: Monitor,
7877
SP: ShMemProvider + 'static,
79-
S: DeserializeOwned + UsesInput + 'a,
78+
S: DeserializeOwned + State + 'a,
8079
{
8180
/// The ShmemProvider to use
8281
shmem_provider: SP,
@@ -121,7 +120,7 @@ where
121120
CF: FnOnce(Option<S>, LlmpRestartingEventManager<S, SP>, CoreId) -> Result<(), Error>,
122121
MT: Monitor + Clone,
123122
SP: ShMemProvider + 'static,
124-
S: DeserializeOwned + UsesInput,
123+
S: DeserializeOwned + State,
125124
{
126125
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
127126
f.debug_struct("Launcher")
@@ -141,7 +140,7 @@ impl<'a, CF, MT, S, SP> Launcher<'a, CF, MT, S, SP>
141140
where
142141
CF: FnOnce(Option<S>, LlmpRestartingEventManager<S, SP>, CoreId) -> Result<(), Error>,
143142
MT: Monitor + Clone,
144-
S: DeserializeOwned + UsesInput + HasExecutions,
143+
S: DeserializeOwned + State + HasExecutions,
145144
SP: ShMemProvider + 'static,
146145
{
147146
/// Launch the broker and the clients and fuzz
@@ -401,7 +400,7 @@ where
401400
S::Input: 'a,
402401
MT: Monitor,
403402
SP: ShMemProvider + 'static,
404-
S: DeserializeOwned + UsesInput + 'a,
403+
S: DeserializeOwned + State + 'a,
405404
{
406405
/// The ShmemProvider to use
407406
shmem_provider: SP,
@@ -454,7 +453,7 @@ where
454453
) -> Result<(), Error>,
455454
MT: Monitor + Clone,
456455
SP: ShMemProvider + 'static,
457-
S: DeserializeOwned + UsesInput,
456+
S: DeserializeOwned + State,
458457
{
459458
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
460459
f.debug_struct("Launcher")
@@ -478,7 +477,7 @@ where
478477
CoreId,
479478
) -> Result<(), Error>,
480479
MT: Monitor + Clone,
481-
S: DeserializeOwned + UsesInput + HasExecutions,
480+
S: DeserializeOwned + State + HasExecutions,
482481
SP: ShMemProvider + 'static,
483482
{
484483
/// Launch the broker and the clients and fuzz

libafl/src/events/llmp.rs

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ use crate::{
5252
inputs::{Input, InputConverter, UsesInput},
5353
monitors::Monitor,
5454
observers::ObserversTuple,
55-
state::{HasExecutions, HasLastReportTime, HasMetadata, HasScalabilityMonitor, UsesState},
55+
state::{
56+
HasExecutions, HasLastReportTime, HasMetadata, HasScalabilityMonitor, State, UsesState,
57+
},
5658
Error,
5759
};
5860

@@ -345,7 +347,7 @@ pub trait EventStatsCollector {}
345347
/// using low-level message passing, [`libafl_bolts::llmp`].
346348
pub struct LlmpEventManager<S, SP>
347349
where
348-
S: UsesInput,
350+
S: State,
349351
SP: ShMemProvider + 'static,
350352
{
351353
/// The LLMP client for inter process communication
@@ -405,7 +407,7 @@ where
405407
impl<S, SP> core::fmt::Debug for LlmpEventManager<S, SP>
406408
where
407409
SP: ShMemProvider + 'static,
408-
S: UsesInput,
410+
S: State,
409411
{
410412
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
411413
let mut debug_struct = f.debug_struct("LlmpEventManager");
@@ -423,7 +425,7 @@ where
423425
impl<S, SP> Drop for LlmpEventManager<S, SP>
424426
where
425427
SP: ShMemProvider + 'static,
426-
S: UsesInput,
428+
S: State,
427429
{
428430
/// LLMP clients will have to wait until their pages are mapped by somebody.
429431
fn drop(&mut self) {
@@ -433,7 +435,7 @@ where
433435

434436
impl<S, SP> LlmpEventManager<S, SP>
435437
where
436-
S: UsesInput,
438+
S: State,
437439
SP: ShMemProvider + 'static,
438440
{
439441
/// Create a manager from a raw LLMP client
@@ -549,7 +551,7 @@ where
549551

550552
impl<S, SP> LlmpEventManager<S, SP>
551553
where
552-
S: UsesInput + HasExecutions + HasMetadata,
554+
S: State + HasExecutions + HasMetadata,
553555
SP: ShMemProvider + 'static,
554556
{
555557
// Handle arriving events in the client
@@ -627,7 +629,7 @@ where
627629
}
628630
}
629631

630-
impl<S: UsesInput, SP: ShMemProvider> LlmpEventManager<S, SP> {
632+
impl<S: State, SP: ShMemProvider> LlmpEventManager<S, SP> {
631633
/// Send information that this client is exiting.
632634
/// The other side may free up all allocated memory.
633635
/// We are no longer allowed to send anything afterwards.
@@ -638,15 +640,15 @@ impl<S: UsesInput, SP: ShMemProvider> LlmpEventManager<S, SP> {
638640

639641
impl<S, SP> UsesState for LlmpEventManager<S, SP>
640642
where
641-
S: UsesInput,
643+
S: State,
642644
SP: ShMemProvider,
643645
{
644646
type State = S;
645647
}
646648

647649
impl<S, SP> EventFirer for LlmpEventManager<S, SP>
648650
where
649-
S: UsesInput,
651+
S: State,
650652
SP: ShMemProvider,
651653
{
652654
#[cfg(feature = "llmp_compression")]
@@ -740,7 +742,7 @@ where
740742

741743
impl<S, SP> EventRestarter for LlmpEventManager<S, SP>
742744
where
743-
S: UsesInput,
745+
S: State,
744746
SP: ShMemProvider,
745747
{
746748
/// The LLMP client needs to wait until a broker has mapped all pages before shutting down.
@@ -753,7 +755,7 @@ where
753755

754756
impl<E, S, SP, Z> EventProcessor<E, Z> for LlmpEventManager<S, SP>
755757
where
756-
S: UsesInput + HasExecutions + HasMetadata + HasScalabilityMonitor,
758+
S: State + HasExecutions + HasMetadata + HasScalabilityMonitor,
757759
SP: ShMemProvider,
758760
E: HasObservers<State = S> + Executor<Self, Z>,
759761
for<'a> E::Observers: Deserialize<'a>,
@@ -800,15 +802,15 @@ impl<E, S, SP, Z> EventManager<E, Z> for LlmpEventManager<S, SP>
800802
where
801803
E: HasObservers<State = S> + Executor<Self, Z>,
802804
for<'a> E::Observers: Deserialize<'a>,
803-
S: UsesInput + HasExecutions + HasMetadata + HasLastReportTime + HasScalabilityMonitor,
805+
S: State + HasExecutions + HasMetadata + HasLastReportTime + HasScalabilityMonitor,
804806
SP: ShMemProvider,
805807
Z: EvaluatorObservers<E::Observers, State = S> + ExecutionProcessor<E::Observers, State = S>,
806808
{
807809
}
808810

809811
impl<S, SP> HasCustomBufHandlers for LlmpEventManager<S, SP>
810812
where
811-
S: UsesInput,
813+
S: State,
812814
SP: ShMemProvider,
813815
{
814816
fn add_custom_buf_handler(
@@ -821,14 +823,14 @@ where
821823

822824
impl<S, SP> ProgressReporter for LlmpEventManager<S, SP>
823825
where
824-
S: UsesInput + HasExecutions + HasMetadata + HasLastReportTime,
826+
S: State + HasExecutions + HasMetadata + HasLastReportTime,
825827
SP: ShMemProvider,
826828
{
827829
}
828830

829831
impl<S, SP> HasEventManagerId for LlmpEventManager<S, SP>
830832
where
831-
S: UsesInput,
833+
S: State,
832834
SP: ShMemProvider,
833835
{
834836
/// Gets the id assigned to this staterestorer.
@@ -842,7 +844,7 @@ where
842844
#[derive(Debug)]
843845
pub struct LlmpRestartingEventManager<S, SP>
844846
where
845-
S: UsesInput,
847+
S: State,
846848
SP: ShMemProvider + 'static,
847849
//CE: CustomEvent<I>,
848850
{
@@ -891,14 +893,14 @@ where
891893
impl<S, SP> EventStatsCollector for LlmpRestartingEventManager<S, SP>
892894
where
893895
SP: ShMemProvider + 'static,
894-
S: UsesInput,
896+
S: State,
895897
{
896898
}
897899

898900
#[cfg(feature = "std")]
899901
impl<S, SP> UsesState for LlmpRestartingEventManager<S, SP>
900902
where
901-
S: UsesInput,
903+
S: State,
902904
SP: ShMemProvider + 'static,
903905
{
904906
type State = S;
@@ -907,7 +909,7 @@ where
907909
#[cfg(feature = "std")]
908910
impl<S, SP> ProgressReporter for LlmpRestartingEventManager<S, SP>
909911
where
910-
S: UsesInput + HasExecutions + HasMetadata + HasLastReportTime + Serialize,
912+
S: State + HasExecutions + HasMetadata + HasLastReportTime + Serialize,
911913
SP: ShMemProvider,
912914
{
913915
}
@@ -916,7 +918,7 @@ where
916918
impl<S, SP> EventFirer for LlmpRestartingEventManager<S, SP>
917919
where
918920
SP: ShMemProvider,
919-
S: UsesInput,
921+
S: State,
920922
//CE: CustomEvent<I>,
921923
{
922924
fn fire(
@@ -943,7 +945,7 @@ where
943945
#[cfg(feature = "std")]
944946
impl<S, SP> EventRestarter for LlmpRestartingEventManager<S, SP>
945947
where
946-
S: UsesInput + HasExecutions + Serialize,
948+
S: State + HasExecutions + Serialize,
947949
SP: ShMemProvider,
948950
//CE: CustomEvent<I>,
949951
{
@@ -981,7 +983,7 @@ impl<E, S, SP, Z> EventProcessor<E, Z> for LlmpRestartingEventManager<S, SP>
981983
where
982984
E: HasObservers<State = S> + Executor<LlmpEventManager<S, SP>, Z>,
983985
for<'a> E::Observers: Deserialize<'a>,
984-
S: UsesInput + HasExecutions + HasMetadata + HasScalabilityMonitor,
986+
S: State + HasExecutions + HasMetadata + HasScalabilityMonitor,
985987
SP: ShMemProvider + 'static,
986988
Z: EvaluatorObservers<E::Observers, State = S> + ExecutionProcessor<E::Observers>, //CE: CustomEvent<I>,
987989
{
@@ -995,12 +997,7 @@ impl<E, S, SP, Z> EventManager<E, Z> for LlmpRestartingEventManager<S, SP>
995997
where
996998
E: HasObservers<State = S> + Executor<LlmpEventManager<S, SP>, Z>,
997999
for<'a> E::Observers: Deserialize<'a>,
998-
S: UsesInput
999-
+ HasExecutions
1000-
+ HasScalabilityMonitor
1001-
+ HasMetadata
1002-
+ HasLastReportTime
1003-
+ Serialize,
1000+
S: State + HasExecutions + HasScalabilityMonitor + HasMetadata + HasLastReportTime + Serialize,
10041001
SP: ShMemProvider + 'static,
10051002
Z: EvaluatorObservers<E::Observers, State = S> + ExecutionProcessor<E::Observers>, //CE: CustomEvent<I>,
10061003
{
@@ -1009,7 +1006,7 @@ where
10091006
#[cfg(feature = "std")]
10101007
impl<S, SP> HasEventManagerId for LlmpRestartingEventManager<S, SP>
10111008
where
1012-
S: UsesInput + Serialize,
1009+
S: State + Serialize,
10131010
SP: ShMemProvider + 'static,
10141011
{
10151012
fn mgr_id(&self) -> EventManagerId {
@@ -1026,7 +1023,7 @@ const _ENV_FUZZER_BROKER_CLIENT_INITIAL: &str = "_AFL_ENV_FUZZER_BROKER_CLIENT";
10261023
#[cfg(feature = "std")]
10271024
impl<S, SP> LlmpRestartingEventManager<S, SP>
10281025
where
1029-
S: UsesInput,
1026+
S: State,
10301027
SP: ShMemProvider + 'static,
10311028
//CE: CustomEvent<I>,
10321029
{
@@ -1090,7 +1087,7 @@ pub fn setup_restarting_mgr_std<MT, S>(
10901087
) -> Result<(Option<S>, LlmpRestartingEventManager<S, StdShMemProvider>), Error>
10911088
where
10921089
MT: Monitor + Clone,
1093-
S: DeserializeOwned + UsesInput + HasExecutions,
1090+
S: DeserializeOwned + State + HasExecutions,
10941091
{
10951092
RestartingMgr::builder()
10961093
.shmem_provider(StdShMemProvider::new()?)
@@ -1151,7 +1148,7 @@ where
11511148
impl<MT, S, SP> RestartingMgr<MT, S, SP>
11521149
where
11531150
SP: ShMemProvider,
1154-
S: UsesInput + HasExecutions + DeserializeOwned,
1151+
S: State + HasExecutions + DeserializeOwned,
11551152
MT: Monitor + Clone,
11561153
{
11571154
/// Launch the restarting manager
@@ -1608,7 +1605,7 @@ where
16081605

16091606
impl<IC, ICB, DI, S, SP> UsesState for LlmpEventConverter<IC, ICB, DI, S, SP>
16101607
where
1611-
S: UsesInput,
1608+
S: State,
16121609
SP: ShMemProvider,
16131610
IC: InputConverter<From = S::Input, To = DI>,
16141611
ICB: InputConverter<From = DI, To = S::Input>,
@@ -1619,7 +1616,7 @@ where
16191616

16201617
impl<IC, ICB, DI, S, SP> EventFirer for LlmpEventConverter<IC, ICB, DI, S, SP>
16211618
where
1622-
S: UsesInput,
1619+
S: State,
16231620
SP: ShMemProvider,
16241621
IC: InputConverter<From = S::Input, To = DI>,
16251622
ICB: InputConverter<From = DI, To = S::Input>,

0 commit comments

Comments
 (0)