From 19f5081bd8ce0c043642b6075501988cdd2c6691 Mon Sep 17 00:00:00 2001 From: "Dongjia \"toka\" Zhang" Date: Thu, 22 Feb 2024 14:58:51 +0100 Subject: [PATCH] Add several warnings when starting forkserver (#1877) --- libafl/src/executors/forkserver.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libafl/src/executors/forkserver.rs b/libafl/src/executors/forkserver.rs index 5e042a204b..d11b61a02c 100644 --- a/libafl/src/executors/forkserver.rs +++ b/libafl/src/executors/forkserver.rs @@ -7,6 +7,7 @@ use core::{ time::Duration, }; use std::{ + env, ffi::{OsStr, OsString}, io::{self, prelude::*, ErrorKind}, os::{ @@ -290,6 +291,14 @@ impl Forkserver { debug_output: bool, kill_signal: Signal, ) -> Result { + if env::var("AFL_MAP_SIZE").is_err() { + log::warn!("AFL_MAP_SIZE not set. If it is unset, the forkserver may fail to start up"); + } + + if env::var("__AFL_SHM_ID").is_err() { + log::warn!("__AFL_SHM_ID not set. It is necessary to set this env, otherwise the forkserver cannot communicate with the fuzzer"); + } + let mut st_pipe = Pipe::new().unwrap(); let mut ctl_pipe = Pipe::new().unwrap();