diff --git a/fuzzers/binary_only/fuzzbench_qemu/src/fuzzer.rs b/fuzzers/binary_only/fuzzbench_qemu/src/fuzzer.rs index 240d2932df..f3a29a2765 100644 --- a/fuzzers/binary_only/fuzzbench_qemu/src/fuzzer.rs +++ b/fuzzers/binary_only/fuzzbench_qemu/src/fuzzer.rs @@ -48,18 +48,11 @@ use libafl_bolts::{ use libafl_qemu::{ elf::EasyElf, filter_qemu_args, - // asan::{init_with_asan, QemuAsanHelper}, - modules::cmplog::{CmpLogModule, CmpLogObserver}, - modules::edges::StdEdgeCoverageModule, - modules::AsanModule, - Emulator, - GuestReg, - //snapshot::QemuSnapshotHelper, - MmapPerms, - QemuExecutor, - QemuExitError, - QemuExitReason, - QemuShutdownCause, + modules::{ + cmplog::{CmpLogModule, CmpLogObserver}, + edges::StdEdgeCoverageModule, + }, + Emulator, GuestReg, MmapPerms, QemuExecutor, QemuExitError, QemuExitReason, QemuShutdownCause, Regs, }; use libafl_targets::{edges_map_mut_ptr, EDGES_MAP_ALLOCATED_SIZE, MAX_EDGES_FOUND}; diff --git a/libafl/src/executors/hooks/unix.rs b/libafl/src/executors/hooks/unix.rs index ffec12cf13..d0575c8d9f 100644 --- a/libafl/src/executors/hooks/unix.rs +++ b/libafl/src/executors/hooks/unix.rs @@ -52,6 +52,12 @@ pub mod unix_signal_handler { unsafe { let data = &raw mut GLOBAL_STATE; let in_handler = (*data).set_in_handler(true); + + assert!( + !in_handler, + "We crashed inside a crash handler, but this should never happen!" + ); + match signal { Signal::SigUser2 | Signal::SigAlarm => { if !(*data).timeout_handler.is_null() { @@ -91,6 +97,12 @@ pub mod unix_signal_handler { old_hook(panic_info); let data = &raw mut GLOBAL_STATE; let in_handler = (*data).set_in_handler(true); + + assert!( + !in_handler, + "We crashed inside a crash panic hook, but this should never happen!" + ); + if (*data).is_valid() { // We are fuzzing! let executor = (*data).executor_mut::(); diff --git a/libafl/src/executors/hooks/windows.rs b/libafl/src/executors/hooks/windows.rs index 3cbcadc32e..9472c122ed 100644 --- a/libafl/src/executors/hooks/windows.rs +++ b/libafl/src/executors/hooks/windows.rs @@ -34,7 +34,13 @@ pub mod windows_asan_handler { Z: HasObjective, { let data = &raw mut GLOBAL_STATE; - (*data).set_in_handler(true); + let in_handler = (*data).set_in_handler(true); + + assert!( + !in_handler, + "We crashed inside a asan death handler, but this should never happen!" + ); + // Have we set a timer_before? if (*data).ptp_timer.is_some() { /* @@ -159,6 +165,12 @@ pub mod windows_exception_handler { unsafe { let data = &raw mut GLOBAL_STATE; let in_handler = (*data).set_in_handler(true); + + assert!( + !in_handler, + "We crashed inside a crash handler, but this should never happen!" + ); + if !(*data).crash_handler.is_null() { let func: HandlerFuncPtr = transmute((*data).crash_handler); (func)(exception_pointers, data); @@ -193,6 +205,12 @@ pub mod windows_exception_handler { panic::set_hook(Box::new(move |panic_info| unsafe { let data = &raw mut GLOBAL_STATE; let in_handler = (*data).set_in_handler(true); + + assert!( + !in_handler, + "We crashed inside a panic hook, but this should never happen!" + ); + // Have we set a timer_before? if (*data).ptp_timer.is_some() { /*