From dc82a53bec85d21e4daba112a1d9199e2ce53908 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Mon, 22 May 2023 12:13:07 +0100 Subject: [PATCH] minibsod dragonflybsd's portage (#1287) --- libafl/src/bolts/minibsod.rs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/libafl/src/bolts/minibsod.rs b/libafl/src/bolts/minibsod.rs index 105e84423f..f312ba39ae 100644 --- a/libafl/src/bolts/minibsod.rs +++ b/libafl/src/bolts/minibsod.rs @@ -179,7 +179,10 @@ pub fn dump_registers( } /// Write the content of all important registers -#[cfg(all(target_os = "freebsd", target_arch = "x86_64"))] +#[cfg(all( + any(target_os = "freebsd", target_os = "dragonfly"), + target_arch = "x86_64" +))] #[allow(clippy::similar_names)] pub fn dump_registers( writer: &mut BufWriter, @@ -391,6 +394,7 @@ pub fn dump_registers( target_os = "linux", target_os = "android", target_os = "freebsd", + target_os = "dragonfly", target_os = "netbsd", target_os = "openbsd", any(target_os = "solaris", target_os = "illumos"), @@ -512,7 +516,7 @@ fn write_crash( Ok(()) } -#[cfg(target_os = "freebsd")] +#[cfg(all(target_os = "freebsd", target_arch = "x86_64"))] #[allow(clippy::similar_names)] fn write_crash( writer: &mut BufWriter, @@ -528,6 +532,22 @@ fn write_crash( Ok(()) } +#[cfg(all(target_os = "dragonfly", target_arch = "x86_64"))] +#[allow(clippy::similar_names)] +fn write_crash( + writer: &mut BufWriter, + signal: Signal, + ucontext: &ucontext_t, +) -> Result<(), std::io::Error> { + writeln!( + writer, + "Received signal {} at{:016x}, fault address: 0x{:016x}", + signal, ucontext.uc_mcontext.mc_rip, ucontext.uc_mcontext.mc_cs + )?; + + Ok(()) +} + #[cfg(target_os = "openbsd")] #[allow(clippy::similar_names)] fn write_crash( @@ -584,6 +604,7 @@ fn write_crash( target_os = "linux", target_os = "android", target_os = "freebsd", + target_os = "dragonfly", target_os = "openbsd", target_os = "netbsd", any(target_os = "solaris", target_os = "illumos"),