Add signal option to forkserver_simple (#548)
This commit is contained in:
parent
ba4cca0e15
commit
b3d68e8f40
@ -18,3 +18,4 @@ opt-level = 3
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
libafl = { path = "../../libafl/" }
|
libafl = { path = "../../libafl/" }
|
||||||
clap = { version = "3.0", features = ["default"] }
|
clap = { version = "3.0", features = ["default"] }
|
||||||
|
nix = "0.23"
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
use clap::{App, Arg};
|
||||||
use core::time::Duration;
|
use core::time::Duration;
|
||||||
use libafl::{
|
use libafl::{
|
||||||
bolts::{
|
bolts::{
|
||||||
@ -23,10 +24,9 @@ use libafl::{
|
|||||||
stages::mutational::StdMutationalStage,
|
stages::mutational::StdMutationalStage,
|
||||||
state::{HasCorpus, HasMetadata, StdState},
|
state::{HasCorpus, HasMetadata, StdState},
|
||||||
};
|
};
|
||||||
|
use nix::sys::signal::Signal;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use clap::{App, Arg};
|
|
||||||
|
|
||||||
#[allow(clippy::similar_names)]
|
#[allow(clippy::similar_names)]
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let res = App::new("forkserver_simple")
|
let res = App::new("forkserver_simple")
|
||||||
@ -62,6 +62,13 @@ pub fn main() {
|
|||||||
.setting(clap::ArgSettings::MultipleValues)
|
.setting(clap::ArgSettings::MultipleValues)
|
||||||
.takes_value(true),
|
.takes_value(true),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::new("signal")
|
||||||
|
.help("Signal used to stop child")
|
||||||
|
.short('s')
|
||||||
|
.long("signal")
|
||||||
|
.default_value("SIGKILL"),
|
||||||
|
)
|
||||||
.get_matches();
|
.get_matches();
|
||||||
|
|
||||||
let corpus_dirs = vec![PathBuf::from(res.value_of("in").unwrap().to_string())];
|
let corpus_dirs = vec![PathBuf::from(res.value_of("in").unwrap().to_string())];
|
||||||
@ -155,7 +162,7 @@ pub fn main() {
|
|||||||
.build(tuple_list!(time_observer, edges_observer))
|
.build(tuple_list!(time_observer, edges_observer))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let mut executor = TimeoutForkserverExecutor::new(
|
let mut executor = TimeoutForkserverExecutor::with_signal(
|
||||||
forkserver,
|
forkserver,
|
||||||
Duration::from_millis(
|
Duration::from_millis(
|
||||||
res.value_of("timeout")
|
res.value_of("timeout")
|
||||||
@ -164,6 +171,7 @@ pub fn main() {
|
|||||||
.parse()
|
.parse()
|
||||||
.expect("Could not parse timeout in milliseconds"),
|
.expect("Could not parse timeout in milliseconds"),
|
||||||
),
|
),
|
||||||
|
res.value_of("signal").unwrap().parse::<Signal>().unwrap(),
|
||||||
)
|
)
|
||||||
.expect("Failed to create the executor.");
|
.expect("Failed to create the executor.");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user