Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

enable generic-analysis as an optional component of libfuzzer local tasks #688

Merged
merged 1 commit into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions src/agent/onefuzz-agent/src/local/generic_analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,45 +60,55 @@ pub async fn run(args: &clap::ArgMatches<'_>) -> Result<()> {
run_analysis(config).await
}

pub fn build_shared_args() -> Vec<Arg<'static, 'static>> {
pub fn build_shared_args(required_task: bool) -> Vec<Arg<'static, 'static>> {
vec![
Arg::with_name(TARGET_EXE)
.long(TARGET_EXE)
.takes_value(true)
.required(true),
Arg::with_name(TARGET_ENV)
.long(TARGET_ENV)
.requires(TARGET_EXE)
.takes_value(true)
.multiple(true),
Arg::with_name(TARGET_OPTIONS)
.default_value("{input}")
.long(TARGET_OPTIONS)
.takes_value(true)
.default_value("{input}")
.value_delimiter(" ")
.help("Use a quoted string with space separation to denote multiple arguments"),
Arg::with_name(CRASHES_DIR)
.long(CRASHES_DIR)
.takes_value(true)
.required(true),
Arg::with_name(ANALYZER_EXE)
.takes_value(true)
.required(true),
.takes_value(true),
Arg::with_name(ANALYZER_OPTIONS)
.long(ANALYZER_OPTIONS)
.requires(ANALYZER_EXE)
.takes_value(true)
.value_delimiter(" ")
.help("Use a quoted string with space separation to denote multiple arguments"),
Arg::with_name(ANALYZER_ENV)
.long(ANALYZER_ENV)
.requires(ANALYZER_EXE)
.takes_value(true)
.multiple(true),
Arg::with_name(TOOLS_DIR).long(TOOLS_DIR).takes_value(true),
Arg::with_name(ANALYZER_EXE)
.long(ANALYZER_EXE)
.takes_value(true)
.requires(ANALYSIS_DIR)
.requires(CRASHES_DIR)
.required(required_task),
Arg::with_name(ANALYSIS_DIR)
.long(ANALYSIS_DIR)
.takes_value(true)
.required(true),
Arg::with_name(TOOLS_DIR).takes_value(true).required(false),
.requires(ANALYZER_EXE)
.requires(CRASHES_DIR)
.required(required_task),
]
}

pub fn args(name: &'static str) -> App<'static, 'static> {
SubCommand::with_name(name)
.about("execute a local-only generic analysis")
.args(&build_shared_args())
.args(&build_shared_args(true))
}
3 changes: 2 additions & 1 deletion src/agent/onefuzz-agent/src/local/libfuzzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::{
build_common_config, wait_for_dir, DirectoryMonitorQueue, ANALYZER_EXE, COVERAGE_DIR,
UNIQUE_REPORTS_DIR,
},
generic_analysis::build_analysis_config,
generic_analysis::{build_analysis_config, build_shared_args as build_analysis_args},
libfuzzer_coverage::{build_coverage_config, build_shared_args as build_coverage_args},
libfuzzer_crash_report::{build_report_config, build_shared_args as build_crash_args},
libfuzzer_fuzz::{build_fuzz_config, build_shared_args as build_fuzz_args},
Expand Down Expand Up @@ -109,6 +109,7 @@ pub fn args(name: &'static str) -> App<'static, 'static> {
for args in &[
build_fuzz_args(),
build_crash_args(),
build_analysis_args(false),
build_coverage_args(true),
] {
for arg in args {
Expand Down