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

expose minimized_stack_depth functionality in the CLI/API #715

Merged
merged 3 commits into from
Mar 23, 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
24 changes: 24 additions & 0 deletions docs/webhook_events.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions src/api-service/__app__/onefuzzlib/tasks/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/api-service/__app__/onefuzzlib/tasks/defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=[
Expand Down Expand Up @@ -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=[
Expand Down Expand Up @@ -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=[
Expand Down Expand Up @@ -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=[
Expand Down
2 changes: 2 additions & 0 deletions src/cli/onefuzz/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
),
)

Expand Down
5 changes: 5 additions & 0 deletions src/cli/onefuzz/templates/libfuzzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -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 = [
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down
1 change: 1 addition & 0 deletions src/pytypes/onefuzztypes/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions src/pytypes/onefuzztypes/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down