Skip to content

Commit d0d378c

Browse files
authored
bolts write_minibsod solaris version (#1494)
1 parent 0003342 commit d0d378c

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

libafl_bolts/src/minibsod.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
//! function to get a [`ucontext_t`].
55
66
use std::io::{BufWriter, Write};
7+
#[cfg(any(target_os = "solaris", target_os = "illumos"))]
8+
use std::process::Command;
79

810
use libc::siginfo_t;
911

@@ -794,12 +796,27 @@ fn write_minibsod<W: Write>(writer: &mut BufWriter<W>) -> Result<(), std::io::Er
794796
Ok(())
795797
}
796798

799+
#[cfg(any(target_os = "solaris", target_os = "illumos"))]
800+
fn write_minibsod<W: Write>(writer: &mut BufWriter<W>) -> Result<(), std::io::Error> {
801+
let pid = format!("{}", unsafe { libc::getpid() });
802+
let mut cmdname = Command::new("pmap");
803+
let cmd = cmdname.args(["-x", &pid]);
804+
805+
match cmd.output() {
806+
Ok(s) => writer.write_all(&s.stdout)?,
807+
Err(e) => writeln!(writer, "Couldn't load mappings: {e:?}")?,
808+
}
809+
810+
Ok(())
811+
}
812+
797813
#[cfg(not(any(
798814
target_os = "freebsd",
799815
target_os = "openbsd",
800816
target_os = "netbsd",
801817
target_env = "apple",
802818
any(target_os = "linux", target_os = "android"),
819+
any(target_os = "solaris", target_os = "illumos"),
803820
)))]
804821
fn write_minibsod<W: Write>(writer: &mut BufWriter<W>) -> Result<(), std::io::Error> {
805822
// TODO for other platforms

0 commit comments

Comments
 (0)