parent
cf87895aaa
commit
4e302a2115
@ -309,6 +309,7 @@ impl Forkserver {
|
|||||||
memlimit: u64,
|
memlimit: u64,
|
||||||
is_persistent: bool,
|
is_persistent: bool,
|
||||||
is_deferred_frksrv: bool,
|
is_deferred_frksrv: bool,
|
||||||
|
coverage_map_size: Option<usize>,
|
||||||
debug_output: bool,
|
debug_output: bool,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
Self::with_kill_signal(
|
Self::with_kill_signal(
|
||||||
@ -320,6 +321,7 @@ impl Forkserver {
|
|||||||
memlimit,
|
memlimit,
|
||||||
is_persistent,
|
is_persistent,
|
||||||
is_deferred_frksrv,
|
is_deferred_frksrv,
|
||||||
|
coverage_map_size,
|
||||||
debug_output,
|
debug_output,
|
||||||
KILL_SIGNAL_DEFAULT,
|
KILL_SIGNAL_DEFAULT,
|
||||||
)
|
)
|
||||||
@ -338,15 +340,20 @@ impl Forkserver {
|
|||||||
memlimit: u64,
|
memlimit: u64,
|
||||||
is_persistent: bool,
|
is_persistent: bool,
|
||||||
is_deferred_frksrv: bool,
|
is_deferred_frksrv: bool,
|
||||||
|
coverage_map_size: Option<usize>,
|
||||||
debug_output: bool,
|
debug_output: bool,
|
||||||
kill_signal: Signal,
|
kill_signal: Signal,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
|
let Some(coverage_map_size) = coverage_map_size else {
|
||||||
|
return Err(Error::unknown("Coverage map size unknown. Use coverage_map_size() to tell the forkserver about the map size."));
|
||||||
|
};
|
||||||
|
|
||||||
if env::var("AFL_MAP_SIZE").is_err() {
|
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");
|
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() {
|
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");
|
return Err(Error::unknown("__AFL_SHM_ID not set. It is necessary to set this env, otherwise the forkserver cannot communicate with the fuzzer".to_string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut st_pipe = Pipe::new().unwrap();
|
let mut st_pipe = Pipe::new().unwrap();
|
||||||
@ -366,6 +373,8 @@ impl Forkserver {
|
|||||||
.stdout(stdout)
|
.stdout(stdout)
|
||||||
.stderr(stderr);
|
.stderr(stderr);
|
||||||
|
|
||||||
|
command.env("AFL_MAP_SIZE", format!("{coverage_map_size}"));
|
||||||
|
|
||||||
// Persistent, deferred forkserver
|
// Persistent, deferred forkserver
|
||||||
if is_persistent {
|
if is_persistent {
|
||||||
command.env("__AFL_PERSISTENT", "1");
|
command.env("__AFL_PERSISTENT", "1");
|
||||||
@ -813,6 +822,7 @@ where
|
|||||||
0,
|
0,
|
||||||
self.is_persistent,
|
self.is_persistent,
|
||||||
self.is_deferred_frksrv,
|
self.is_deferred_frksrv,
|
||||||
|
self.map_size,
|
||||||
self.debug_child,
|
self.debug_child,
|
||||||
self.kill_signal.unwrap_or(KILL_SIGNAL_DEFAULT),
|
self.kill_signal.unwrap_or(KILL_SIGNAL_DEFAULT),
|
||||||
)?,
|
)?,
|
||||||
@ -1515,6 +1525,7 @@ mod tests {
|
|||||||
let executor = ForkserverExecutor::builder()
|
let executor = ForkserverExecutor::builder()
|
||||||
.program(bin)
|
.program(bin)
|
||||||
.args(args)
|
.args(args)
|
||||||
|
.coverage_map_size(MAP_SIZE)
|
||||||
.debug_child(false)
|
.debug_child(false)
|
||||||
.shmem_provider(&mut shmem_provider)
|
.shmem_provider(&mut shmem_provider)
|
||||||
.build::<_, ()>(tuple_list!(edges_observer));
|
.build::<_, ()>(tuple_list!(edges_observer));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user