diff --git a/docs/webhook_events.md b/docs/webhook_events.md index c1d5bc6070..40c47abe15 100644 --- a/docs/webhook_events.md +++ b/docs/webhook_events.md @@ -1702,6 +1702,10 @@ Each event will be submitted via HTTP POST to the user provided URL. "title": "Generator Options", "type": "array" }, + "minimized_stack_depth": { + "title": "Minimized Stack Depth", + "type": "integer" + }, "preserve_existing_outputs": { "title": "Preserve Existing Outputs", "type": "boolean" @@ -2192,6 +2196,10 @@ Each event will be submitted via HTTP POST to the user provided URL. "title": "Generator Options", "type": "array" }, + "minimized_stack_depth": { + "title": "Minimized Stack Depth", + "type": "integer" + }, "preserve_existing_outputs": { "title": "Preserve Existing Outputs", "type": "boolean" @@ -2627,6 +2635,10 @@ Each event will be submitted via HTTP POST to the user provided URL. "title": "Generator Options", "type": "array" }, + "minimized_stack_depth": { + "title": "Minimized Stack Depth", + "type": "integer" + }, "preserve_existing_outputs": { "title": "Preserve Existing Outputs", "type": "boolean" @@ -3036,6 +3048,10 @@ Each event will be submitted via HTTP POST to the user provided URL. "title": "Generator Options", "type": "array" }, + "minimized_stack_depth": { + "title": "Minimized Stack Depth", + "type": "integer" + }, "preserve_existing_outputs": { "title": "Preserve Existing Outputs", "type": "boolean" @@ -3472,6 +3488,10 @@ Each event will be submitted via HTTP POST to the user provided URL. "title": "Generator Options", "type": "array" }, + "minimized_stack_depth": { + "title": "Minimized Stack Depth", + "type": "integer" + }, "preserve_existing_outputs": { "title": "Preserve Existing Outputs", "type": "boolean" @@ -4782,6 +4802,10 @@ Each event will be submitted via HTTP POST to the user provided URL. "title": "Generator Options", "type": "array" }, + "minimized_stack_depth": { + "title": "Minimized Stack Depth", + "type": "integer" + }, "preserve_existing_outputs": { "title": "Preserve Existing Outputs", "type": "boolean" diff --git a/src/api-service/__app__/onefuzzlib/job_templates/defaults/libfuzzer.py b/src/api-service/__app__/onefuzzlib/job_templates/defaults/libfuzzer.py index 21f6efc2f1..299ae54cc6 100644 --- a/src/api-service/__app__/onefuzzlib/job_templates/defaults/libfuzzer.py +++ b/src/api-service/__app__/onefuzzlib/job_templates/defaults/libfuzzer.py @@ -311,6 +311,17 @@ ), ], ), + UserField( + name="minimized_stack_depth", + help="Number of frames to include in the minimized stack", + type=UserFieldType.Int, + locations=[ + UserFieldLocation( + op=UserFieldOperation.replace, + path="/tasks/1/task/minimized_stack_depth", + ), + ], + ), UserField( name="tags", help=TAGS_HELP, diff --git a/src/api-service/__app__/onefuzzlib/tasks/config.py b/src/api-service/__app__/onefuzzlib/tasks/config.py index f973bd001b..1508fb5a53 100644 --- a/src/api-service/__app__/onefuzzlib/tasks/config.py +++ b/src/api-service/__app__/onefuzzlib/tasks/config.py @@ -351,6 +351,9 @@ def build_task_config( if TaskFeature.report_list in definition.features: config.report_list = task_config.task.report_list + if TaskFeature.minimized_stack_depth in definition.features: + config.minimized_stack_depth = task_config.task.minimized_stack_depth + if TaskFeature.expect_crash_on_failure in definition.features: config.expect_crash_on_failure = ( task_config.task.expect_crash_on_failure diff --git a/src/api-service/__app__/onefuzzlib/tasks/defs.py b/src/api-service/__app__/onefuzzlib/tasks/defs.py index 619922e1ed..2b16b5c3a0 100644 --- a/src/api-service/__app__/onefuzzlib/tasks/defs.py +++ b/src/api-service/__app__/onefuzzlib/tasks/defs.py @@ -106,6 +106,7 @@ TaskFeature.target_timeout, TaskFeature.check_retry_count, TaskFeature.check_fuzzer_help, + TaskFeature.minimized_stack_depth, ], vm=VmDefinition(compare=Compare.AtLeast, value=1), containers=[ @@ -378,6 +379,7 @@ TaskFeature.check_asan_log, TaskFeature.check_debugger, TaskFeature.check_retry_count, + TaskFeature.minimized_stack_depth, ], vm=VmDefinition(compare=Compare.AtLeast, value=1), containers=[ @@ -424,6 +426,7 @@ TaskFeature.check_debugger, TaskFeature.check_retry_count, TaskFeature.report_list, + TaskFeature.minimized_stack_depth, ], vm=VmDefinition(compare=Compare.AtLeast, value=1), containers=[ @@ -487,6 +490,7 @@ TaskFeature.check_fuzzer_help, TaskFeature.check_retry_count, TaskFeature.report_list, + TaskFeature.minimized_stack_depth, ], vm=VmDefinition(compare=Compare.AtLeast, value=1), containers=[ diff --git a/src/cli/onefuzz/api.py b/src/cli/onefuzz/api.py index 739e7926bc..707a18fca3 100644 --- a/src/cli/onefuzz/api.py +++ b/src/cli/onefuzz/api.py @@ -848,6 +848,7 @@ def create( preserve_existing_outputs: bool = False, colocate: bool = False, report_list: Optional[List[str]] = None, + minimized_stack_depth: Optional[int] = None, ) -> models.Task: """ Create a task @@ -912,6 +913,7 @@ def create( wait_for_files=task_wait_for_files, report_list=report_list, preserve_existing_outputs=preserve_existing_outputs, + minimized_stack_depth=minimized_stack_depth, ), ) diff --git a/src/cli/onefuzz/templates/libfuzzer.py b/src/cli/onefuzz/templates/libfuzzer.py index 63013c5cc0..e90b64ff07 100644 --- a/src/cli/onefuzz/templates/libfuzzer.py +++ b/src/cli/onefuzz/templates/libfuzzer.py @@ -59,6 +59,7 @@ def _create_tasks( colocate_secondary_tasks: bool = True, check_fuzzer_help: bool = True, expect_crash_on_failure: bool = True, + minimized_stack_depth: Optional[int] = None, ) -> None: regression_containers = [ @@ -89,6 +90,7 @@ def _create_tasks( check_fuzzer_help=check_fuzzer_help, debug=debug, colocate=colocate_all_tasks or colocate_secondary_tasks, + minimized_stack_depth=minimized_stack_depth, ) fuzzer_containers = [ @@ -175,6 +177,7 @@ def _create_tasks( check_fuzzer_help=check_fuzzer_help, debug=debug, colocate=colocate_all_tasks or colocate_secondary_tasks, + minimized_stack_depth=minimized_stack_depth, ) def basic( @@ -208,6 +211,7 @@ def basic( colocate_secondary_tasks: bool = True, check_fuzzer_help: bool = True, expect_crash_on_failure: bool = True, + minimized_stack_depth: Optional[int] = None, ) -> Optional[Job]: """ Basic libfuzzer job @@ -288,6 +292,7 @@ def basic( colocate_secondary_tasks=colocate_secondary_tasks, check_fuzzer_help=check_fuzzer_help, expect_crash_on_failure=expect_crash_on_failure, + minimized_stack_depth=minimized_stack_depth, ) self.logger.info("done creating tasks") diff --git a/src/pytypes/onefuzztypes/enums.py b/src/pytypes/onefuzztypes/enums.py index bb856ee851..698b700f6e 100644 --- a/src/pytypes/onefuzztypes/enums.py +++ b/src/pytypes/onefuzztypes/enums.py @@ -79,6 +79,7 @@ class TaskFeature(Enum): check_fuzzer_help = "check_fuzzer_help" expect_crash_on_failure = "expect_crash_on_failure" report_list = "report_list" + minimized_stack_depth = "minimized_stack_depth" # Permissions for an Azure Blob Storage Container. diff --git a/src/pytypes/onefuzztypes/models.py b/src/pytypes/onefuzztypes/models.py index 414373138a..b7abb129d1 100644 --- a/src/pytypes/onefuzztypes/models.py +++ b/src/pytypes/onefuzztypes/models.py @@ -171,6 +171,7 @@ class TaskDetails(BaseModel): ensemble_sync_delay: Optional[int] preserve_existing_outputs: Optional[bool] report_list: Optional[List[str]] + minimized_stack_depth: Optional[int] @validator("check_retry_count", allow_reuse=True) def validate_check_retry_count(cls, value: int) -> int: @@ -399,6 +400,7 @@ class TaskUnitConfig(BaseModel): stats_format: Optional[StatsFormat] ensemble_sync_delay: Optional[int] report_list: Optional[List[str]] + minimized_stack_depth: Optional[int] # from here forwards are Container definitions. These need to be inline # with TaskDefinitions and ContainerTypes