From 53bfae0a088f4a5dcaa9e90fb3357dd8d049b0c5 Mon Sep 17 00:00:00 2001 From: "Dongjia \"toka\" Zhang" Date: Mon, 25 Mar 2024 19:15:46 +0100 Subject: [PATCH] Increase llmp timeout & Print PID in logger (#1970) * increase timeout & print pid for logger * log * aa * rename stuff --- libafl/src/events/llmp.rs | 3 ++- libafl/src/events/mod.rs | 6 +++--- libafl/src/fuzzer/mod.rs | 2 ++ libafl_bolts/src/lib.rs | 9 ++++++--- libafl_bolts/src/llmp.rs | 2 +- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/libafl/src/events/llmp.rs b/libafl/src/events/llmp.rs index 206d4d1685..cf54e2cfb0 100644 --- a/libafl/src/events/llmp.rs +++ b/libafl/src/events/llmp.rs @@ -205,7 +205,7 @@ where Ok(llmp::LlmpMsgHookResult::ForwardToClients) } } else { - monitor.display("Broker", ClientId(0)); + monitor.display("Broker Heartbeat", ClientId(0)); Ok(llmp::LlmpMsgHookResult::Handled) } }, @@ -249,6 +249,7 @@ where if id == client_id { // do not update executions for forwarded messages, otherwise we loose the total order // as a forwarded msg with a lower executions may arrive after a stats msg with an higher executions + // this also means when you wrap this event manger with centralized EM, you will **NOT** get executions update with the new tc message client.update_executions(*executions, *time); } monitor.display(event.name(), id); diff --git a/libafl/src/events/mod.rs b/libafl/src/events/mod.rs index f97ef86442..345f5f1ece 100644 --- a/libafl/src/events/mod.rs +++ b/libafl/src/events/mod.rs @@ -386,12 +386,12 @@ where time: _, executions: _, phantom: _, - } - | Event::UpdateUserStats { + } => "Client Heartbeat", + Event::UpdateUserStats { name: _, value: _, phantom: _, - } => "Stats", + } => "UserStats", #[cfg(feature = "introspection")] Event::UpdatePerfMonitor { time: _, diff --git a/libafl/src/fuzzer/mod.rs b/libafl/src/fuzzer/mod.rs index 492aa019cc..7f7c491a7d 100644 --- a/libafl/src/fuzzer/mod.rs +++ b/libafl/src/fuzzer/mod.rs @@ -180,6 +180,7 @@ where ) -> Result<(), Error> { let monitor_timeout = STATS_TIMEOUT_DEFAULT; loop { + // log::info!("Starting another fuzz_loop"); manager.maybe_report_progress(state, monitor_timeout)?; self.fuzz_one(stages, executor, state, manager)?; } @@ -212,6 +213,7 @@ where let monitor_timeout = STATS_TIMEOUT_DEFAULT; for _ in 0..iters { + // log::info!("Starting another fuzz_loop"); manager.maybe_report_progress(state, monitor_timeout)?; ret = Some(self.fuzz_one(stages, executor, state, manager)?); } diff --git a/libafl_bolts/src/lib.rs b/libafl_bolts/src/lib.rs index 49cc417308..d1d40e536c 100644 --- a/libafl_bolts/src/lib.rs +++ b/libafl_bolts/src/lib.rs @@ -872,8 +872,9 @@ impl log::Log for SimpleStdoutLogger { fn log(&self, record: &Record) { println!( - "[{:?}] {}: {}", + "[{:?}, {:?}] {}: {}", current_time(), + std::process::id(), record.level(), record.args() ); @@ -918,8 +919,9 @@ impl log::Log for SimpleStderrLogger { fn log(&self, record: &Record) { eprintln!( - "[{:?}] {}: {}", + "[{:?}, {:?}] {}: {}", current_time(), + std::process::id(), record.level(), record.args() ); @@ -982,8 +984,9 @@ impl log::Log for SimpleFdLogger { let mut f = unsafe { File::from_raw_fd(self.fd) }; writeln!( f, - "[{:?}] {}: {}", + "[{:?}, {:#?}] {}: {}", current_time(), + std::process::id(), record.level(), record.args() ) diff --git a/libafl_bolts/src/llmp.rs b/libafl_bolts/src/llmp.rs index e983c76892..6137ddb92e 100644 --- a/libafl_bolts/src/llmp.rs +++ b/libafl_bolts/src/llmp.rs @@ -105,7 +105,7 @@ use crate::{ }; /// The default timeout in seconds after which a client will be considered stale, and removed. -pub const DEFAULT_CLIENT_TIMEOUT_SECS: Duration = Duration::from_secs(300); +pub const DEFAULT_CLIENT_TIMEOUT_SECS: Duration = Duration::from_secs(7200); /// The max number of pages a [`client`] may have mapped that were not yet read by the [`broker`] /// Usually, this value should not exceed `1`, else the broker cannot keep up with the amount of incoming messages.