From f7cd0707b82ed44fb4b8f3eca4a60d5dc8837e0f Mon Sep 17 00:00:00 2001 From: karan Date: Tue, 12 May 2026 15:51:47 +0530 Subject: [PATCH 1/2] fix: gate generate_minibsod behind LIBAFL_MINIBSOD env var Calling generate_minibsod() unconditionally in inproc_crash_handler produces megabytes of output (backtrace, registers, memory maps) that doesn't appear in standard libFuzzer. This is especially noisy in libafl_libfuzzer_runtime compatibility mode where ASan already provides the relevant stack trace. Gate the minibsod output behind the LIBAFL_MINIBSOD environment variable so it is opt-in. Users who want the full diagnostic output can set LIBAFL_MINIBSOD=1. Fixes #3792 --- .../libafl/src/executors/hooks/inprocess.rs | 24 ++++++++++--------- crates/libafl/src/executors/hooks/unix.rs | 4 ++-- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/crates/libafl/src/executors/hooks/inprocess.rs b/crates/libafl/src/executors/hooks/inprocess.rs index 7a952bbb953..b8357be2e0d 100644 --- a/crates/libafl/src/executors/hooks/inprocess.rs +++ b/crates/libafl/src/executors/hooks/inprocess.rs @@ -496,17 +496,19 @@ impl InProcessExecutorHandlerData { log::error!("Target crashed!"); - if let Some(bsod_info) = bsod_info { - let bsod = generate_minibsod_to_vec( - bsod_info.signal, - &bsod_info.siginfo, - bsod_info.ucontext.as_ref(), - ); - - if let Ok(bsod) = bsod - && let Ok(r) = core::str::from_utf8(&bsod) - { - log::error!("{r}"); + if std::env::var("LIBAFL_MINIBSOD").is_ok() { + if let Some(bsod_info) = bsod_info { + let bsod = generate_minibsod_to_vec( + bsod_info.signal, + &bsod_info.siginfo, + bsod_info.ucontext.as_ref(), + ); + + if let Ok(bsod) = bsod + && let Ok(r) = core::str::from_utf8(&bsod) + { + log::error!("{r}"); + } } } diff --git a/crates/libafl/src/executors/hooks/unix.rs b/crates/libafl/src/executors/hooks/unix.rs index 2ffcc3f13de..1724be07282 100644 --- a/crates/libafl/src/executors/hooks/unix.rs +++ b/crates/libafl/src/executors/hooks/unix.rs @@ -237,7 +237,7 @@ pub mod unix_signal_handler { log::error!("Child crashed!"); - { + if std::env::var("LIBAFL_MINIBSOD").is_ok() { let mut bsod = Vec::new(); { let mut writer = std::io::BufWriter::new(&mut bsod); @@ -278,7 +278,7 @@ pub mod unix_signal_handler { "We crashed at addr 0x{si_addr:x}, but are not in the target... Bug in the fuzzer? Exiting." ); - { + if std::env::var("LIBAFL_MINIBSOD").is_ok() { let mut bsod = Vec::new(); { let mut writer = std::io::BufWriter::new(&mut bsod); From 26c2bc39a62b29b98bea111f57ee34d72f926efa Mon Sep 17 00:00:00 2001 From: karan Date: Wed, 13 May 2026 11:07:18 +0530 Subject: [PATCH 2/2] style: collapse nested if per clippy --- .../libafl/src/executors/hooks/inprocess.rs | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/crates/libafl/src/executors/hooks/inprocess.rs b/crates/libafl/src/executors/hooks/inprocess.rs index b8357be2e0d..586e3ab49ee 100644 --- a/crates/libafl/src/executors/hooks/inprocess.rs +++ b/crates/libafl/src/executors/hooks/inprocess.rs @@ -496,19 +496,19 @@ impl InProcessExecutorHandlerData { log::error!("Target crashed!"); - if std::env::var("LIBAFL_MINIBSOD").is_ok() { - if let Some(bsod_info) = bsod_info { - let bsod = generate_minibsod_to_vec( - bsod_info.signal, - &bsod_info.siginfo, - bsod_info.ucontext.as_ref(), - ); - - if let Ok(bsod) = bsod - && let Ok(r) = core::str::from_utf8(&bsod) - { - log::error!("{r}"); - } + if std::env::var("LIBAFL_MINIBSOD").is_ok() + && let Some(bsod_info) = bsod_info + { + let bsod = generate_minibsod_to_vec( + bsod_info.signal, + &bsod_info.siginfo, + bsod_info.ucontext.as_ref(), + ); + + if let Ok(bsod) = bsod + && let Ok(r) = core::str::from_utf8(&bsod) + { + log::error!("{r}"); } }