mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-18 12:48:07 +00:00
check libfuzzer -help=1
prior to starting the heartbeat (#528)
This commit is contained in:
@ -21,6 +21,7 @@ use tokio::task::spawn;
|
|||||||
pub async fn run(args: &clap::ArgMatches<'_>) -> Result<()> {
|
pub async fn run(args: &clap::ArgMatches<'_>) -> Result<()> {
|
||||||
let fuzz_config = build_fuzz_config(args)?;
|
let fuzz_config = build_fuzz_config(args)?;
|
||||||
let fuzzer = LibFuzzerFuzzTask::new(fuzz_config)?;
|
let fuzzer = LibFuzzerFuzzTask::new(fuzz_config)?;
|
||||||
|
fuzzer.check_libfuzzer().await?;
|
||||||
let fuzz_task = spawn(async move { fuzzer.run().await });
|
let fuzz_task = spawn(async move { fuzzer.run().await });
|
||||||
|
|
||||||
let report_config = build_report_config(args)?;
|
let report_config = build_report_config(args)?;
|
||||||
|
@ -162,7 +162,7 @@ impl Config {
|
|||||||
match self {
|
match self {
|
||||||
Config::LibFuzzerFuzz(config) => {
|
Config::LibFuzzerFuzz(config) => {
|
||||||
fuzz::libfuzzer_fuzz::LibFuzzerFuzzTask::new(config)?
|
fuzz::libfuzzer_fuzz::LibFuzzerFuzzTask::new(config)?
|
||||||
.run()
|
.managed_run()
|
||||||
.await
|
.await
|
||||||
}
|
}
|
||||||
Config::LibFuzzerReport(config) => {
|
Config::LibFuzzerReport(config) => {
|
||||||
|
@ -106,19 +106,22 @@ impl CoverageTask {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn managed_run(&mut self) -> Result<()> {
|
async fn check_libfuzzer(&self) -> Result<()> {
|
||||||
info!("starting libFuzzer coverage task");
|
|
||||||
|
|
||||||
if self.config.check_fuzzer_help {
|
if self.config.check_fuzzer_help {
|
||||||
let target = LibFuzzer::new(
|
let fuzzer = LibFuzzer::new(
|
||||||
&self.config.target_exe,
|
&self.config.target_exe,
|
||||||
&self.config.target_options,
|
&self.config.target_options,
|
||||||
&self.config.target_env,
|
&self.config.target_env,
|
||||||
&self.config.common.setup_dir,
|
&self.config.common.setup_dir,
|
||||||
);
|
);
|
||||||
target.check_help().await?;
|
fuzzer.check_help().await?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn managed_run(&mut self) -> Result<()> {
|
||||||
|
info!("starting libFuzzer coverage task");
|
||||||
|
self.check_libfuzzer().await?;
|
||||||
self.config.coverage.init_pull().await?;
|
self.config.coverage.init_pull().await?;
|
||||||
self.process().await
|
self.process().await
|
||||||
}
|
}
|
||||||
|
@ -80,6 +80,11 @@ impl LibFuzzerFuzzTask {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn managed_run(&self) -> Result<()> {
|
||||||
|
self.check_libfuzzer().await?;
|
||||||
|
self.run().await
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn run(&self) -> Result<()> {
|
pub async fn run(&self) -> Result<()> {
|
||||||
self.init_directories().await?;
|
self.init_directories().await?;
|
||||||
|
|
||||||
@ -98,6 +103,19 @@ impl LibFuzzerFuzzTask {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn check_libfuzzer(&self) -> Result<()> {
|
||||||
|
if self.config.check_fuzzer_help {
|
||||||
|
let fuzzer = LibFuzzer::new(
|
||||||
|
&self.config.target_exe,
|
||||||
|
&self.config.target_options,
|
||||||
|
&self.config.target_env,
|
||||||
|
&self.config.common.setup_dir,
|
||||||
|
);
|
||||||
|
fuzzer.check_help().await?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn run_fuzzers(&self, stats_sender: Option<&StatsSender>) -> Result<()> {
|
pub async fn run_fuzzers(&self, stats_sender: Option<&StatsSender>) -> Result<()> {
|
||||||
let fuzzers: Vec<_> = (0..self.workers())
|
let fuzzers: Vec<_> = (0..self.workers())
|
||||||
.map(|id| self.start_fuzzer_monitor(id, stats_sender))
|
.map(|id| self.start_fuzzer_monitor(id, stats_sender))
|
||||||
|
Reference in New Issue
Block a user