@@ -18,7 +18,7 @@ use libafl_bolts::{
18
18
use libafl_bolts:: {
19
19
current_time,
20
20
llmp:: { LlmpClient , LlmpClientDescription , LLMP_FLAG_FROM_MM } ,
21
- shmem:: { NopShMem , NopShMemProvider , ShMem , ShMemProvider } ,
21
+ shmem:: { NopShMem , ShMem , ShMemProvider } ,
22
22
tuples:: Handle ,
23
23
ClientId ,
24
24
} ;
@@ -38,18 +38,18 @@ use crate::events::{serialize_observers_adaptive, CanSerializeObserver};
38
38
use crate :: {
39
39
events:: {
40
40
llmp:: { LLMP_TAG_EVENT_TO_BOTH , _LLMP_TAG_EVENT_TO_BROKER} ,
41
- std_maybe_report_progress, std_on_restart, std_report_progress, AdaptiveSerializer , Event ,
42
- EventConfig , EventFirer , EventManagerHooksTuple , EventManagerId , EventProcessor ,
43
- EventRestarter , HasEventManagerId , ManagerExit , ProgressReporter ,
41
+ std_maybe_report_progress, std_on_restart, std_report_progress, AdaptiveSerializer ,
42
+ AwaitRestartSafe , Event , EventConfig , EventFirer , EventManagerHooksTuple , EventManagerId ,
43
+ EventProcessor , EventRestarter , HasEventManagerId , ProgressReporter , SendExiting ,
44
44
} ,
45
45
executors:: HasObservers ,
46
46
fuzzer:: { EvaluatorObservers , ExecutionProcessor } ,
47
- inputs:: { Input , NopInput } ,
47
+ inputs:: Input ,
48
48
observers:: TimeObserver ,
49
49
stages:: HasCurrentStageId ,
50
50
state:: {
51
51
HasCurrentTestcase , HasExecutions , HasImported , HasLastReportTime , HasSolutions ,
52
- MaybeHasClientPerfMonitor , NopState , Stoppable ,
52
+ MaybeHasClientPerfMonitor , Stoppable ,
53
53
} ,
54
54
Error , HasMetadata ,
55
55
} ;
@@ -62,7 +62,6 @@ const INITIAL_EVENT_BUFFER_SIZE: usize = 1024 * 4;
62
62
pub struct LlmpEventManager < EMH , I , S , SHM , SP >
63
63
where
64
64
SHM : ShMem ,
65
- SP : ShMemProvider < ShMem = SHM > ,
66
65
{
67
66
/// We only send 1 testcase for every `throttle` second
68
67
pub ( crate ) throttle : Option < Duration > ,
@@ -82,11 +81,11 @@ where
82
81
serializations_cnt : usize ,
83
82
should_serialize_cnt : usize ,
84
83
pub ( crate ) time_ref : Option < Handle < TimeObserver > > ,
85
- phantom : PhantomData < ( I , S ) > ,
86
84
event_buffer : Vec < u8 > ,
85
+ phantom : PhantomData < ( I , S ) > ,
87
86
}
88
87
89
- impl LlmpEventManager < ( ) , NopState < NopInput > , NopInput , NopShMem , NopShMemProvider > {
88
+ impl LlmpEventManager < ( ) , ( ) , ( ) , NopShMem , ( ) > {
90
89
/// Creates a builder for [`LlmpEventManager`]
91
90
#[ must_use]
92
91
pub fn builder ( ) -> LlmpEventManagerBuilder < ( ) > {
@@ -143,7 +142,6 @@ impl<EMH> LlmpEventManagerBuilder<EMH> {
143
142
) -> Result < LlmpEventManager < EMH , I , S , SHM , SP > , Error >
144
143
where
145
144
SHM : ShMem ,
146
- SP : ShMemProvider < ShMem = SHM > ,
147
145
{
148
146
Ok ( LlmpEventManager {
149
147
throttle : self . throttle ,
@@ -158,8 +156,8 @@ impl<EMH> LlmpEventManagerBuilder<EMH> {
158
156
serializations_cnt : 0 ,
159
157
should_serialize_cnt : 0 ,
160
158
time_ref,
161
- phantom : PhantomData ,
162
159
event_buffer : Vec :: with_capacity ( INITIAL_EVENT_BUFFER_SIZE ) ,
160
+ phantom : PhantomData ,
163
161
} )
164
162
}
165
163
@@ -217,11 +215,10 @@ impl<EMH> LlmpEventManagerBuilder<EMH> {
217
215
}
218
216
219
217
#[ cfg( feature = "std" ) ]
220
- impl < EMH , I , OT , S , SHM , SP > CanSerializeObserver < OT > for LlmpEventManager < EMH , I , S , SHM , SP >
218
+ impl < EMH , I , S , OT , SHM , SP > CanSerializeObserver < OT > for LlmpEventManager < EMH , I , S , SHM , SP >
221
219
where
222
- OT : Serialize + MatchNameRef ,
220
+ OT : MatchNameRef + Serialize ,
223
221
SHM : ShMem ,
224
- SP : ShMemProvider < ShMem = SHM > ,
225
222
{
226
223
fn serialize_observers ( & mut self , observers : & OT ) -> Result < Option < Vec < u8 > > , Error > {
227
224
serialize_observers_adaptive :: < Self , OT > ( self , observers, 2 , 80 )
@@ -231,7 +228,6 @@ where
231
228
impl < EMH , I , S , SHM , SP > AdaptiveSerializer for LlmpEventManager < EMH , I , S , SHM , SP >
232
229
where
233
230
SHM : ShMem ,
234
- SP : ShMemProvider < ShMem = SHM > ,
235
231
{
236
232
fn serialization_time ( & self ) -> Duration {
237
233
self . serialization_time
@@ -267,7 +263,7 @@ where
267
263
impl < EMH , I , S , SHM , SP > Debug for LlmpEventManager < EMH , I , S , SHM , SP >
268
264
where
269
265
SHM : ShMem ,
270
- SP : ShMemProvider < ShMem = SHM > ,
266
+ SP : Debug ,
271
267
{
272
268
fn fmt ( & self , f : & mut core:: fmt:: Formatter < ' _ > ) -> core:: fmt:: Result {
273
269
let mut debug_struct = f. debug_struct ( "LlmpEventManager" ) ;
@@ -277,15 +273,13 @@ where
277
273
let debug = debug. field ( "compressor" , & self . compressor ) ;
278
274
debug
279
275
. field ( "configuration" , & self . configuration )
280
- . field ( "phantom" , & self . phantom )
281
276
. finish_non_exhaustive ( )
282
277
}
283
278
}
284
279
285
280
impl < EMH , I , S , SHM , SP > Drop for LlmpEventManager < EMH , I , S , SHM , SP >
286
281
where
287
282
SHM : ShMem ,
288
- SP : ShMemProvider < ShMem = SHM > ,
289
283
{
290
284
/// LLMP clients will have to wait until their pages are mapped by somebody.
291
285
fn drop ( & mut self ) {
@@ -296,7 +290,6 @@ where
296
290
impl < EMH , I , S , SHM , SP > LlmpEventManager < EMH , I , S , SHM , SP >
297
291
where
298
292
SHM : ShMem ,
299
- SP : ShMemProvider < ShMem = SHM > ,
300
293
{
301
294
/// Calling this function will tell the llmp broker that this client is exiting
302
295
/// This should be called from the restarter not from the actual fuzzer client
@@ -330,7 +323,12 @@ where
330
323
log:: debug!( "Asking he broker to be disconnected" ) ;
331
324
Ok ( ( ) )
332
325
}
326
+ }
333
327
328
+ impl < EMH , I , S , SHM , SP > LlmpEventManager < EMH , I , S , SHM , SP >
329
+ where
330
+ SHM : ShMem ,
331
+ {
334
332
/// Describe the client event manager's LLMP parts in a restorable fashion
335
333
pub fn describe ( & self ) -> Result < LlmpClientDescription , Error > {
336
334
self . llmp . describe ( )
@@ -347,7 +345,6 @@ where
347
345
impl < EMH , I , S , SHM , SP > LlmpEventManager < EMH , I , S , SHM , SP >
348
346
where
349
347
SHM : ShMem ,
350
- SP : ShMemProvider < ShMem = SHM > ,
351
348
{
352
349
// Handle arriving events in the client
353
350
fn handle_in_client < E , Z > (
@@ -516,23 +513,26 @@ impl<EMH, I, S, SHM, SP> EventRestarter<S> for LlmpEventManager<EMH, I, S, SHM,
516
513
where
517
514
S : HasCurrentStageId ,
518
515
SHM : ShMem ,
519
- SP : ShMemProvider < ShMem = SHM > ,
520
516
{
521
517
fn on_restart ( & mut self , state : & mut S ) -> Result < ( ) , Error > {
522
518
std_on_restart ( self , state)
523
519
}
524
520
}
525
521
526
- impl < EMH , I , S , SHM , SP > ManagerExit for LlmpEventManager < EMH , I , S , SHM , SP >
522
+ impl < EMH , I , S , SHM , SP > SendExiting for LlmpEventManager < EMH , I , S , SHM , SP >
527
523
where
528
- SHM : ShMem ,
529
524
SHM : ShMem ,
530
525
SP : ShMemProvider < ShMem = SHM > ,
531
526
{
532
527
fn send_exiting ( & mut self ) -> Result < ( ) , Error > {
533
528
self . llmp . sender_mut ( ) . send_exiting ( )
534
529
}
530
+ }
535
531
532
+ impl < EMH , I , S , SHM , SP > AwaitRestartSafe for LlmpEventManager < EMH , I , S , SHM , SP >
533
+ where
534
+ SHM : ShMem ,
535
+ {
536
536
/// The LLMP client needs to wait until a broker has mapped all pages before shutting down.
537
537
/// Otherwise, the OS may already have removed the shared maps.
538
538
fn await_restart_safe ( & mut self ) {
@@ -621,7 +621,6 @@ where
621
621
impl < EMH , I , S , SHM , SP > HasEventManagerId for LlmpEventManager < EMH , I , S , SHM , SP >
622
622
where
623
623
SHM : ShMem ,
624
- SP : ShMemProvider < ShMem = SHM > ,
625
624
{
626
625
/// Gets the id assigned to this staterestorer.
627
626
fn mgr_id ( & self ) -> EventManagerId {
0 commit comments