diff --git a/docs/command-replacements.md b/docs/command-replacements.md index d3dd09afb..48a8660ff 100644 --- a/docs/command-replacements.md +++ b/docs/command-replacements.md @@ -26,7 +26,7 @@ The following values are replaced with the specific values at runtime. * `{crashes_container}`: Container name for the `crashes` container * `{microsoft_telemetry_key}`: Application Insights key used for collecting [non-attributable telemetry](telemetry.md) to improve OneFuzz. * `{instance_telemetry_key}`: Application Insights key used for private, instance-owned telemetry and logging (See [OneFuzz Telemetry](telemetry.md). -* `{extra}`: Path to the optionally provided `extra` directory +* `{extra_dir}`: Path to the optionally provided `extra` directory ## Example diff --git a/src/agent/onefuzz-agent/src/setup.rs b/src/agent/onefuzz-agent/src/setup.rs index f5834c348..0362ab1ea 100644 --- a/src/agent/onefuzz-agent/src/setup.rs +++ b/src/agent/onefuzz-agent/src/setup.rs @@ -43,12 +43,15 @@ pub struct SetupRunner { impl SetupRunner { pub async fn run(&self, work_set: &WorkSet) -> Result { - if let (Some(extra_url), Some(extra_dir)) = (&work_set.extra_url, work_set.extra_dir()?) { + if let (Some(extra_container), Some(extra_dir)) = + (&work_set.extra_url, work_set.extra_dir()?) + { info!("downloading extra container"); // `azcopy sync` requires the local dir to exist. fs::create_dir_all(&extra_dir).await.with_context(|| { format!("unable to create extra container: {}", extra_dir.display()) })?; + let extra_url = extra_container.url()?; az_copy::sync(extra_url.to_string(), &extra_dir, false).await?; debug!( "synced extra container from {} to {}", diff --git a/src/agent/onefuzz-agent/src/worker.rs b/src/agent/onefuzz-agent/src/worker.rs index 295062b3a..2c32a8208 100644 --- a/src/agent/onefuzz-agent/src/worker.rs +++ b/src/agent/onefuzz-agent/src/worker.rs @@ -279,7 +279,6 @@ impl IWorkerRunner for WorkerRunner { cmd.arg("config.json"); cmd.arg(setup_dir); if let Some(extra_dir) = extra_dir { - cmd.arg("--extra_dir"); cmd.arg(extra_dir); } diff --git a/src/cli/onefuzz/templates/libfuzzer.py b/src/cli/onefuzz/templates/libfuzzer.py index 323ae57a6..bced7768e 100644 --- a/src/cli/onefuzz/templates/libfuzzer.py +++ b/src/cli/onefuzz/templates/libfuzzer.py @@ -74,7 +74,6 @@ class Libfuzzer(Command): analyzer_options: Optional[List[str]] = None, analyzer_env: Optional[Dict[str, str]] = None, tools: Optional[Container] = None, - extra_container: Optional[Container] = None, ) -> None: target_options = target_options or [] @@ -88,6 +87,11 @@ class Libfuzzer(Command): ), ] + if ContainerType.extra in containers: + regression_containers.append( + (ContainerType.extra, containers[ContainerType.extra]) + ) + # We don't really need a separate timeout for crash reporting, and we could just # use `target_timeout`. But `crash_report_timeout` was introduced first, so we # can't remove it without a breaking change. Since both timeouts may be present, @@ -129,6 +133,11 @@ class Libfuzzer(Command): ) ) + if ContainerType.extra in containers: + fuzzer_containers.append( + (ContainerType.extra, containers[ContainerType.extra]) + ) + self.logger.info("creating libfuzzer task") # disable ensemble sync if only one VM is used @@ -172,6 +181,11 @@ class Libfuzzer(Command): (ContainerType.readonly_inputs, containers[ContainerType.inputs]), ] + if ContainerType.extra in containers: + coverage_containers.append( + (ContainerType.extra, containers[ContainerType.extra]) + ) + if ContainerType.readonly_inputs in containers: coverage_containers.append( ( @@ -232,6 +246,11 @@ class Libfuzzer(Command): (ContainerType.no_repro, containers[ContainerType.no_repro]), ] + if ContainerType.extra in containers: + report_containers.append( + (ContainerType.extra, containers[ContainerType.extra]) + ) + self.logger.info("creating libfuzzer_crash_report task") self.onefuzz.tasks.create( job.job_id, @@ -270,6 +289,11 @@ class Libfuzzer(Command): (ContainerType.crashes, containers[ContainerType.crashes]), ] + if ContainerType.extra in containers: + analysis_containers.append( + (ContainerType.extra, containers[ContainerType.extra]) + ) + self.onefuzz.tasks.create( job.job_id, TaskType.generic_analysis, diff --git a/src/integration-tests/integration-test.py b/src/integration-tests/integration-test.py index 3769c41cb..af2ff061b 100755 --- a/src/integration-tests/integration-test.py +++ b/src/integration-tests/integration-test.py @@ -109,7 +109,7 @@ TARGETS: Dict[str, Integration] = { }, reboot_after_setup=True, inject_fake_regression=True, - fuzzing_target_options=["--test:{extra}"], + fuzzing_target_options=["--test:{extra_dir}"], ), "linux-libfuzzer-with-options": Integration( template=TemplateType.libfuzzer, @@ -181,7 +181,7 @@ TARGETS: Dict[str, Integration] = { os=OS.linux, target_exe="fuzz_target_1", wait_for_files={ContainerType.unique_reports: 1, ContainerType.coverage: 1}, - fuzzing_target_options=["--test:{extra}"], + fuzzing_target_options=["--test:{extra_dir}"], ), "linux-trivial-crash": Integration( template=TemplateType.radamsa, @@ -211,7 +211,7 @@ TARGETS: Dict[str, Integration] = { ContainerType.coverage: 1, }, inject_fake_regression=True, - fuzzing_target_options=["--test:{extra}"], + fuzzing_target_options=["--test:{extra_dir}"], ), "windows-libfuzzer-linked-library": Integration( template=TemplateType.libfuzzer,