From 7170b5391ba10c1ab6eb184ea94bc7867a6d92e5 Mon Sep 17 00:00:00 2001 From: "Dongjia \"toka\" Zhang" Date: Mon, 25 Mar 2024 16:39:30 +0100 Subject: [PATCH] Fix UpdateExecStats not sent to the main broker in centralized --- libafl/src/events/centralized.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libafl/src/events/centralized.rs b/libafl/src/events/centralized.rs index 061775b65c..86c42e3de7 100644 --- a/libafl/src/events/centralized.rs +++ b/libafl/src/events/centralized.rs @@ -292,6 +292,7 @@ where ) -> Result<(), Error> { if !self.is_main { // secondary node + let mut is_tc = false; let is_nt_or_heartbeat = match &mut event { Event::NewTestcase { input: _, @@ -304,19 +305,26 @@ where forward_id, } => { *forward_id = Some(ClientId(self.inner.mgr_id().0 as u32)); + is_tc = true; true } Event::UpdateExecStats { time: _, executions: _, phantom: _, - } => true, + } => true, // send it but this guy won't be handled. the only purpose is to keep this client alive else the broker thinks it is dead and will dc it _ => false, }; + if is_nt_or_heartbeat { - return self.forward_to_main(&event); + self.forward_to_main(&event)?; + if is_tc { + // early return here because we only send it to centralized not main broker. + return Ok(()); + } } } + // now inner llmp manager will process it self.inner.fire(state, event) }