@@ -18,7 +18,7 @@ use libafl_bolts::{
1818use libafl_bolts:: {
1919 current_time,
2020 llmp:: { LlmpClient , LlmpClientDescription , LLMP_FLAG_FROM_MM } ,
21- shmem:: { NopShMem , NopShMemProvider , ShMem , ShMemProvider } ,
21+ shmem:: { NopShMem , ShMem , ShMemProvider } ,
2222 tuples:: Handle ,
2323 ClientId ,
2424} ;
@@ -38,18 +38,18 @@ use crate::events::{serialize_observers_adaptive, CanSerializeObserver};
3838use crate :: {
3939 events:: {
4040 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 ,
4444 } ,
4545 executors:: HasObservers ,
4646 fuzzer:: { EvaluatorObservers , ExecutionProcessor } ,
47- inputs:: { Input , NopInput } ,
47+ inputs:: Input ,
4848 observers:: TimeObserver ,
4949 stages:: HasCurrentStageId ,
5050 state:: {
5151 HasCurrentTestcase , HasExecutions , HasImported , HasLastReportTime , HasSolutions ,
52- MaybeHasClientPerfMonitor , NopState , Stoppable ,
52+ MaybeHasClientPerfMonitor , Stoppable ,
5353 } ,
5454 Error , HasMetadata ,
5555} ;
@@ -62,7 +62,6 @@ const INITIAL_EVENT_BUFFER_SIZE: usize = 1024 * 4;
6262pub struct LlmpEventManager < EMH , I , S , SHM , SP >
6363where
6464 SHM : ShMem ,
65- SP : ShMemProvider < ShMem = SHM > ,
6665{
6766 /// We only send 1 testcase for every `throttle` second
6867 pub ( crate ) throttle : Option < Duration > ,
@@ -82,11 +81,11 @@ where
8281 serializations_cnt : usize ,
8382 should_serialize_cnt : usize ,
8483 pub ( crate ) time_ref : Option < Handle < TimeObserver > > ,
85- phantom : PhantomData < ( I , S ) > ,
8684 event_buffer : Vec < u8 > ,
85+ phantom : PhantomData < ( I , S ) > ,
8786}
8887
89- impl LlmpEventManager < ( ) , NopState < NopInput > , NopInput , NopShMem , NopShMemProvider > {
88+ impl LlmpEventManager < ( ) , ( ) , ( ) , NopShMem , ( ) > {
9089 /// Creates a builder for [`LlmpEventManager`]
9190 #[ must_use]
9291 pub fn builder ( ) -> LlmpEventManagerBuilder < ( ) > {
@@ -143,7 +142,6 @@ impl<EMH> LlmpEventManagerBuilder<EMH> {
143142 ) -> Result < LlmpEventManager < EMH , I , S , SHM , SP > , Error >
144143 where
145144 SHM : ShMem ,
146- SP : ShMemProvider < ShMem = SHM > ,
147145 {
148146 Ok ( LlmpEventManager {
149147 throttle : self . throttle ,
@@ -158,8 +156,8 @@ impl<EMH> LlmpEventManagerBuilder<EMH> {
158156 serializations_cnt : 0 ,
159157 should_serialize_cnt : 0 ,
160158 time_ref,
161- phantom : PhantomData ,
162159 event_buffer : Vec :: with_capacity ( INITIAL_EVENT_BUFFER_SIZE ) ,
160+ phantom : PhantomData ,
163161 } )
164162 }
165163
@@ -217,11 +215,10 @@ impl<EMH> LlmpEventManagerBuilder<EMH> {
217215}
218216
219217#[ 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 >
221219where
222- OT : Serialize + MatchNameRef ,
220+ OT : MatchNameRef + Serialize ,
223221 SHM : ShMem ,
224- SP : ShMemProvider < ShMem = SHM > ,
225222{
226223 fn serialize_observers ( & mut self , observers : & OT ) -> Result < Option < Vec < u8 > > , Error > {
227224 serialize_observers_adaptive :: < Self , OT > ( self , observers, 2 , 80 )
@@ -231,7 +228,6 @@ where
231228impl < EMH , I , S , SHM , SP > AdaptiveSerializer for LlmpEventManager < EMH , I , S , SHM , SP >
232229where
233230 SHM : ShMem ,
234- SP : ShMemProvider < ShMem = SHM > ,
235231{
236232 fn serialization_time ( & self ) -> Duration {
237233 self . serialization_time
@@ -267,7 +263,7 @@ where
267263impl < EMH , I , S , SHM , SP > Debug for LlmpEventManager < EMH , I , S , SHM , SP >
268264where
269265 SHM : ShMem ,
270- SP : ShMemProvider < ShMem = SHM > ,
266+ SP : Debug ,
271267{
272268 fn fmt ( & self , f : & mut core:: fmt:: Formatter < ' _ > ) -> core:: fmt:: Result {
273269 let mut debug_struct = f. debug_struct ( "LlmpEventManager" ) ;
@@ -277,15 +273,13 @@ where
277273 let debug = debug. field ( "compressor" , & self . compressor ) ;
278274 debug
279275 . field ( "configuration" , & self . configuration )
280- . field ( "phantom" , & self . phantom )
281276 . finish_non_exhaustive ( )
282277 }
283278}
284279
285280impl < EMH , I , S , SHM , SP > Drop for LlmpEventManager < EMH , I , S , SHM , SP >
286281where
287282 SHM : ShMem ,
288- SP : ShMemProvider < ShMem = SHM > ,
289283{
290284 /// LLMP clients will have to wait until their pages are mapped by somebody.
291285 fn drop ( & mut self ) {
@@ -296,7 +290,6 @@ where
296290impl < EMH , I , S , SHM , SP > LlmpEventManager < EMH , I , S , SHM , SP >
297291where
298292 SHM : ShMem ,
299- SP : ShMemProvider < ShMem = SHM > ,
300293{
301294 /// Calling this function will tell the llmp broker that this client is exiting
302295 /// This should be called from the restarter not from the actual fuzzer client
@@ -330,7 +323,12 @@ where
330323 log:: debug!( "Asking he broker to be disconnected" ) ;
331324 Ok ( ( ) )
332325 }
326+ }
333327
328+ impl < EMH , I , S , SHM , SP > LlmpEventManager < EMH , I , S , SHM , SP >
329+ where
330+ SHM : ShMem ,
331+ {
334332 /// Describe the client event manager's LLMP parts in a restorable fashion
335333 pub fn describe ( & self ) -> Result < LlmpClientDescription , Error > {
336334 self . llmp . describe ( )
@@ -347,7 +345,6 @@ where
347345impl < EMH , I , S , SHM , SP > LlmpEventManager < EMH , I , S , SHM , SP >
348346where
349347 SHM : ShMem ,
350- SP : ShMemProvider < ShMem = SHM > ,
351348{
352349 // Handle arriving events in the client
353350 fn handle_in_client < E , Z > (
@@ -516,23 +513,26 @@ impl<EMH, I, S, SHM, SP> EventRestarter<S> for LlmpEventManager<EMH, I, S, SHM,
516513where
517514 S : HasCurrentStageId ,
518515 SHM : ShMem ,
519- SP : ShMemProvider < ShMem = SHM > ,
520516{
521517 fn on_restart ( & mut self , state : & mut S ) -> Result < ( ) , Error > {
522518 std_on_restart ( self , state)
523519 }
524520}
525521
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 >
527523where
528- SHM : ShMem ,
529524 SHM : ShMem ,
530525 SP : ShMemProvider < ShMem = SHM > ,
531526{
532527 fn send_exiting ( & mut self ) -> Result < ( ) , Error > {
533528 self . llmp . sender_mut ( ) . send_exiting ( )
534529 }
530+ }
535531
532+ impl < EMH , I , S , SHM , SP > AwaitRestartSafe for LlmpEventManager < EMH , I , S , SHM , SP >
533+ where
534+ SHM : ShMem ,
535+ {
536536 /// The LLMP client needs to wait until a broker has mapped all pages before shutting down.
537537 /// Otherwise, the OS may already have removed the shared maps.
538538 fn await_restart_safe ( & mut self ) {
@@ -621,7 +621,6 @@ where
621621impl < EMH , I , S , SHM , SP > HasEventManagerId for LlmpEventManager < EMH , I , S , SHM , SP >
622622where
623623 SHM : ShMem ,
624- SP : ShMemProvider < ShMem = SHM > ,
625624{
626625 /// Gets the id assigned to this staterestorer.
627626 fn mgr_id ( & self ) -> EventManagerId {
0 commit comments