Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bolts write_minibsod solaris version. #1494

Merged
merged 1 commit into from
Aug 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions libafl_bolts/src/minibsod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

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

#[cfg(any(target_os = "solaris", target_os = "illumos"))]
fn write_minibsod<W: Write>(writer: &mut BufWriter<W>) -> 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<W: Write>(writer: &mut BufWriter<W>) -> Result<(), std::io::Error> {
// TODO for other platforms
Expand Down