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

Commit

Permalink
expose minimized_stack_depth functionality in the CLI/API (#715)
Browse files Browse the repository at this point in the history
bmc-msft authored Mar 23, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 92d8299 commit 516b1e0
Showing 8 changed files with 52 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/webhook_events.md
Original file line number Diff line number Diff line change
@@ -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"
Original file line number Diff line number Diff line change
@@ -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,
3 changes: 3 additions & 0 deletions src/api-service/__app__/onefuzzlib/tasks/config.py
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions src/api-service/__app__/onefuzzlib/tasks/defs.py
Original file line number Diff line number Diff line change
@@ -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=[
2 changes: 2 additions & 0 deletions src/cli/onefuzz/api.py
Original file line number Diff line number Diff line change
@@ -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,
),
)

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

0 comments on commit 516b1e0

Please sign in to comment.