From d0d378c17414ee7c8fe71b93664fa5fd82866503 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Thu, 31 Aug 2023 21:48:43 +0100 Subject: [PATCH] bolts write_minibsod solaris version (#1494) --- libafl_bolts/src/minibsod.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/libafl_bolts/src/minibsod.rs b/libafl_bolts/src/minibsod.rs index 71fbcad5a1..b130f1f2db 100644 --- a/libafl_bolts/src/minibsod.rs +++ b/libafl_bolts/src/minibsod.rs @@ -4,6 +4,8 @@ //! function to get a [`ucontext_t`]. use std::io::{BufWriter, Write}; +#[cfg(any(target_os = "solaris", target_os = "illumos"))] +use std::process::Command; use libc::siginfo_t; @@ -794,12 +796,27 @@ fn write_minibsod(writer: &mut BufWriter) -> Result<(), std::io::Er Ok(()) } +#[cfg(any(target_os = "solaris", target_os = "illumos"))] +fn write_minibsod(writer: &mut BufWriter) -> Result<(), std::io::Error> { + let pid = format!("{}", unsafe { libc::getpid() }); + let mut cmdname = Command::new("pmap"); + let cmd = cmdname.args(["-x", &pid]); + + match cmd.output() { + Ok(s) => writer.write_all(&s.stdout)?, + Err(e) => writeln!(writer, "Couldn't load mappings: {e:?}")?, + } + + Ok(()) +} + #[cfg(not(any( target_os = "freebsd", target_os = "openbsd", target_os = "netbsd", target_env = "apple", any(target_os = "linux", target_os = "android"), + any(target_os = "solaris", target_os = "illumos"), )))] fn write_minibsod(writer: &mut BufWriter) -> Result<(), std::io::Error> { // TODO for other platforms