diff --git a/.gitignore b/.gitignore index 475c38a9e2..991eee5de6 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,9 @@ Cargo.lock *.bin *.dll *.exe +*.dSYM + +.cur_input crashes diff --git a/libafl/src/bolts/os/mod.rs b/libafl/src/bolts/os/mod.rs index 06717ecb5d..c4a1239da3 100644 --- a/libafl/src/bolts/os/mod.rs +++ b/libafl/src/bolts/os/mod.rs @@ -18,7 +18,10 @@ pub mod unix_signals; pub mod pipes; #[cfg(all(unix, feature = "std"))] -use std::{ffi::CString, fs::File}; +use std::ffi::CString; + +#[cfg(all(feature = "std", any(target_os = "linux", target_os = "android")))] +use std::fs::File; #[cfg(all(windows, feature = "std"))] pub mod windows_exceptions; diff --git a/libafl/src/executors/forkserver.rs b/libafl/src/executors/forkserver.rs index b6f8bc0011..9db3436135 100644 --- a/libafl/src/executors/forkserver.rs +++ b/libafl/src/executors/forkserver.rs @@ -266,7 +266,7 @@ where I: Input + HasTargetBytes, OT: ObserversTuple, { - pub fn new(target: String, arguments: Vec, observers: OT) -> Result { + pub fn new(target: String, arguments: &[String], observers: OT) -> Result { let mut args = Vec::::new(); let mut use_stdin = true; let out_filename = ".cur_input".to_string(); @@ -418,10 +418,9 @@ mod tests { Error, }; #[test] - fn test_forkserver() { const MAP_SIZE: usize = 65536; - let bin = "/usr/bin/echo".to_string(); + let bin = "echo"; let args = vec![String::from("@@")]; let mut shmem = StdShMemProvider::new() @@ -436,8 +435,11 @@ mod tests { &mut shmem_map, )); - let executor = - ForkserverExecutor::::new(bin, args, tuple_list!(edges_observer)); + let executor = ForkserverExecutor::::new( + bin.to_string(), + &args, + tuple_list!(edges_observer), + ); // Since /usr/bin/echo is not a instrumented binary file, the test will just check if the forkserver has failed at the initial handshake let result = match executor { Ok(_) => true, diff --git a/scripts/shmem_limits.sh b/scripts/shmem_limits.sh new file mode 100755 index 0000000000..0573e5a5d7 --- /dev/null +++ b/scripts/shmem_limits.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +sudo sysctl -w kern.sysv.shmmax=524288000 +sudo sysctl -w kern.sysv.shmmin=1 +sudo sysctl -w kern.sysv.shmmni=64 +sudo sysctl -w kern.sysv.shmseg=16 +sudo sysctl -w kern.sysv.semmns=130 +sudo sysctl -w kern.sysv.shmall=131072000 +sudo sysctl -w kern.sysv.maxproc=2048 +sudo sysctl -w kern.maxprocperuid=512