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
This commit is contained in:
Cheick Keita
2023-03-28 12:47:38 -07:00
committed by GitHub
parent 3c3f12a7e4
commit 795ece3675

View File

@ -357,6 +357,7 @@ class Libfuzzer(Command):
analyzer_env: Optional[Dict[str, str]] = None, analyzer_env: Optional[Dict[str, str]] = None,
tools: Optional[Container] = None, tools: Optional[Container] = None,
extra_container: Optional[Container] = None, extra_container: Optional[Container] = None,
crashes: Optional[Container] = None,
) -> Optional[Job]: ) -> Optional[Job]:
""" """
Basic libfuzzer job Basic libfuzzer job
@ -372,6 +373,9 @@ class Libfuzzer(Command):
if readonly_inputs: if readonly_inputs:
self.onefuzz.containers.get(readonly_inputs) self.onefuzz.containers.get(readonly_inputs)
if crashes:
self.onefuzz.containers.get(crashes)
if dryrun: if dryrun:
return None return None
@ -412,6 +416,9 @@ class Libfuzzer(Command):
if readonly_inputs: if readonly_inputs:
helper.containers[ContainerType.readonly_inputs] = readonly_inputs helper.containers[ContainerType.readonly_inputs] = readonly_inputs
if crashes:
helper.containers[ContainerType.crashes] = crashes
if analyzer_exe is not None: if analyzer_exe is not None:
helper.define_containers(ContainerType.analysis) helper.define_containers(ContainerType.analysis)
@ -635,6 +642,7 @@ class Libfuzzer(Command):
expect_crash_on_failure: bool = False, expect_crash_on_failure: bool = False,
notification_config: Optional[NotificationConfig] = None, notification_config: Optional[NotificationConfig] = None,
extra_container: Optional[Container] = None, extra_container: Optional[Container] = None,
crashes: Optional[Container] = None,
) -> Optional[Job]: ) -> Optional[Job]:
pool = self.onefuzz.pools.get(pool_name) pool = self.onefuzz.pools.get(pool_name)
@ -645,6 +653,9 @@ class Libfuzzer(Command):
if readonly_inputs: if readonly_inputs:
self.onefuzz.containers.get(readonly_inputs) self.onefuzz.containers.get(readonly_inputs)
if crashes:
self.onefuzz.containers.get(crashes)
# We _must_ proactively specify the OS based on pool. # We _must_ proactively specify the OS based on pool.
# #
# This is because managed DLLs are always (Windows-native) PE files, so the job # This is because managed DLLs are always (Windows-native) PE files, so the job
@ -698,6 +709,9 @@ class Libfuzzer(Command):
if readonly_inputs: if readonly_inputs:
helper.containers[ContainerType.readonly_inputs] = readonly_inputs helper.containers[ContainerType.readonly_inputs] = readonly_inputs
if crashes:
helper.containers[ContainerType.crashes] = crashes
# Assumes that `libfuzzer-dotnet` and supporting tools were uploaded upon deployment. # Assumes that `libfuzzer-dotnet` and supporting tools were uploaded upon deployment.
fuzzer_tools_container = Container( fuzzer_tools_container = Container(
"dotnet-fuzzing-linux" if platform == OS.linux else "dotnet-fuzzing-windows" "dotnet-fuzzing-linux" if platform == OS.linux else "dotnet-fuzzing-windows"
@ -855,6 +869,7 @@ class Libfuzzer(Command):
check_retry_count: Optional[int] = 300, check_retry_count: Optional[int] = 300,
check_fuzzer_help: bool = True, check_fuzzer_help: bool = True,
extra_container: Optional[Container] = None, extra_container: Optional[Container] = None,
crashes: Optional[Container] = None,
) -> Optional[Job]: ) -> Optional[Job]:
""" """
libfuzzer tasks, wrapped via qemu-user (PREVIEW FEATURE) libfuzzer tasks, wrapped via qemu-user (PREVIEW FEATURE)
@ -907,6 +922,10 @@ class Libfuzzer(Command):
else: else:
helper.define_containers(ContainerType.inputs) helper.define_containers(ContainerType.inputs)
if crashes:
self.onefuzz.containers.get(crashes)
helper.containers[ContainerType.crashes] = crashes
fuzzer_containers = [ fuzzer_containers = [
(ContainerType.setup, helper.containers[ContainerType.setup]), (ContainerType.setup, helper.containers[ContainerType.setup]),
(ContainerType.crashes, helper.containers[ContainerType.crashes]), (ContainerType.crashes, helper.containers[ContainerType.crashes]),