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

Commit 795ece3

Browse files
authored
Add option to specify a known crash container (#2950)
* add option to upload known crash directory * specify a container instead of a directory * remove crash upload
1 parent 3c3f12a commit 795ece3

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/cli/onefuzz/templates/libfuzzer.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ def basic(
357357
analyzer_env: Optional[Dict[str, str]] = None,
358358
tools: Optional[Container] = None,
359359
extra_container: Optional[Container] = None,
360+
crashes: Optional[Container] = None,
360361
) -> Optional[Job]:
361362
"""
362363
Basic libfuzzer job
@@ -372,6 +373,9 @@ def basic(
372373
if readonly_inputs:
373374
self.onefuzz.containers.get(readonly_inputs)
374375

376+
if crashes:
377+
self.onefuzz.containers.get(crashes)
378+
375379
if dryrun:
376380
return None
377381

@@ -412,6 +416,9 @@ def basic(
412416
if readonly_inputs:
413417
helper.containers[ContainerType.readonly_inputs] = readonly_inputs
414418

419+
if crashes:
420+
helper.containers[ContainerType.crashes] = crashes
421+
415422
if analyzer_exe is not None:
416423
helper.define_containers(ContainerType.analysis)
417424

@@ -635,6 +642,7 @@ def dotnet(
635642
expect_crash_on_failure: bool = False,
636643
notification_config: Optional[NotificationConfig] = None,
637644
extra_container: Optional[Container] = None,
645+
crashes: Optional[Container] = None,
638646
) -> Optional[Job]:
639647
pool = self.onefuzz.pools.get(pool_name)
640648

@@ -645,6 +653,9 @@ def dotnet(
645653
if readonly_inputs:
646654
self.onefuzz.containers.get(readonly_inputs)
647655

656+
if crashes:
657+
self.onefuzz.containers.get(crashes)
658+
648659
# We _must_ proactively specify the OS based on pool.
649660
#
650661
# This is because managed DLLs are always (Windows-native) PE files, so the job
@@ -698,6 +709,9 @@ def dotnet(
698709
if readonly_inputs:
699710
helper.containers[ContainerType.readonly_inputs] = readonly_inputs
700711

712+
if crashes:
713+
helper.containers[ContainerType.crashes] = crashes
714+
701715
# Assumes that `libfuzzer-dotnet` and supporting tools were uploaded upon deployment.
702716
fuzzer_tools_container = Container(
703717
"dotnet-fuzzing-linux" if platform == OS.linux else "dotnet-fuzzing-windows"
@@ -855,6 +869,7 @@ def qemu_user(
855869
check_retry_count: Optional[int] = 300,
856870
check_fuzzer_help: bool = True,
857871
extra_container: Optional[Container] = None,
872+
crashes: Optional[Container] = None,
858873
) -> Optional[Job]:
859874
"""
860875
libfuzzer tasks, wrapped via qemu-user (PREVIEW FEATURE)
@@ -907,6 +922,10 @@ def qemu_user(
907922
else:
908923
helper.define_containers(ContainerType.inputs)
909924

925+
if crashes:
926+
self.onefuzz.containers.get(crashes)
927+
helper.containers[ContainerType.crashes] = crashes
928+
910929
fuzzer_containers = [
911930
(ContainerType.setup, helper.containers[ContainerType.setup]),
912931
(ContainerType.crashes, helper.containers[ContainerType.crashes]),

0 commit comments

Comments
 (0)