initial public release

This commit is contained in:
Brian Caswell
2020-09-18 12:21:04 -04:00
parent 9c3aa0bdfb
commit d3a0b292e6
387 changed files with 43810 additions and 28 deletions

View File

View File

@ -0,0 +1,26 @@
{
"call_stack_sha256": "972a371a291ed5668a77576368ead0c46c2bac9f9a16b7fa7c0b48aec5b059b1",
"input_url": "https://fuzzxkbh6uhuuke4m.blob.core.windows.net/oft-asan-crashes/crash",
"executable": "setup/fuzz.exe",
"crash_type": "double-free",
"crash_site": "double-free (/onefuzz/setup/fuzz.exe+0x4f72e2)",
"call_stack": [
"#0 0x4f72e2 (/onefuzz/setup/fuzz.exe+0x4f72e2)",
"#1 0x5273f0 (/onefuzz/setup/fuzz.exe+0x5273f0)",
"#2 0x42fb3a (/onefuzz/setup/fuzz.exe+0x42fb3a)",
"#3 0x41ef87 (/onefuzz/setup/fuzz.exe+0x41ef87)",
"#4 0x424ba1 (/onefuzz/setup/fuzz.exe+0x424ba1)",
"#5 0x44bd72 (/onefuzz/setup/fuzz.exe+0x44bd72)",
"#6 0x7ffff6a9bb96 (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)",
"#7 0x41d879 (/onefuzz/setup/fuzz.exe+0x41d879)"
],
"asan_log": "INFO: Seed: 1720627312\nINFO: Loaded 1 modules (21 inline 8-bit counters): 21 [0x766ef0, 0x766f05), \nINFO: Loaded 1 PC tables (21 PCs): 21 [0x542fd0,0x543120), \nsetup/fuzz.exe: Running 1 inputs 1 time(s) each.\nRunning: ./tmp/crash-66e9fe527ddb160d75f8c2cc373479e841f7999c\n=================================================================\n==16771==ERROR: AddressSanitizer: attempting double-free on 0x602000000050 in thread T0:\n==16771==WARNING: invalid path to external symbolizer!\n==16771==WARNING: Failed to use and restart external symbolizer!\n #0 0x4f72e2 (/onefuzz/setup/fuzz.exe+0x4f72e2)\n #1 0x5273f0 (/onefuzz/setup/fuzz.exe+0x5273f0)\n #2 0x42fb3a (/onefuzz/setup/fuzz.exe+0x42fb3a)\n #3 0x41ef87 (/onefuzz/setup/fuzz.exe+0x41ef87)\n #4 0x424ba1 (/onefuzz/setup/fuzz.exe+0x424ba1)\n #5 0x44bd72 (/onefuzz/setup/fuzz.exe+0x44bd72)\n #6 0x7ffff6a9bb96 (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)\n #7 0x41d879 (/onefuzz/setup/fuzz.exe+0x41d879)\n\n0x602000000050 is located 0 bytes inside of 4-byte region [0x602000000050,0x602000000054)\nfreed by thread T0 here:\n #0 0x4f72e2 (/onefuzz/setup/fuzz.exe+0x4f72e2)\n #1 0x5273e1 (/onefuzz/setup/fuzz.exe+0x5273e1)\n #2 0x42fb3a (/onefuzz/setup/fuzz.exe+0x42fb3a)\n #3 0x41ef87 (/onefuzz/setup/fuzz.exe+0x41ef87)\n #4 0x424ba1 (/onefuzz/setup/fuzz.exe+0x424ba1)\n #5 0x44bd72 (/onefuzz/setup/fuzz.exe+0x44bd72)\n #6 0x7ffff6a9bb96 (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)\n\npreviously allocated by thread T0 here:\n #0 0x4f7663 (/onefuzz/setup/fuzz.exe+0x4f7663)\n #1 0x5273cb (/onefuzz/setup/fuzz.exe+0x5273cb)\n #2 0x42fb3a (/onefuzz/setup/fuzz.exe+0x42fb3a)\n #3 0x41ef87 (/onefuzz/setup/fuzz.exe+0x41ef87)\n #4 0x424ba1 (/onefuzz/setup/fuzz.exe+0x424ba1)\n #5 0x44bd72 (/onefuzz/setup/fuzz.exe+0x44bd72)\n #6 0x7ffff6a9bb96 (/lib/x86_64-linux-gnu/libc.so.6+0x21b96)\n\nSUMMARY: AddressSanitizer: double-free (/onefuzz/setup/fuzz.exe+0x4f72e2) \n==16771==ABORTING\n",
"task_id": "218e1cdb-529a-45dd-b45b-1966d42b652c",
"job_id": "218e1cdb-529a-45dd-b45b-1966d42b652c",
"input_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"input_blob": {
"account": "fuzzxkbh6uhuuke4m",
"container": "oft-asn-crashes",
"name": "crash"
}
}

View File

@ -0,0 +1,4 @@
[pytest]
junit_family=xunit1
filterwarnings =
ignore:.*Using or importing the ABCs from 'collections':DeprecationWarning

View File

@ -0,0 +1,83 @@
#!/usr/bin/env python
#
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import unittest
from typing import Optional, Tuple
from uuid import UUID
from __app__.onefuzzlib.orm import ORMMixin, build_filters
class TestOrm(ORMMixin):
a: int
b: UUID
c: str
d: int
e: int
@classmethod
def key_fields(cls) -> Tuple[str, Optional[str]]:
return ("d", "e")
class TestQueryBuilder(unittest.TestCase):
def test_filter(self) -> None:
self.maxDiff = 999999999999999
self.assertEqual(
build_filters(TestOrm, {"a": [1]}), ("a eq 1", {}), "handle integer"
)
self.assertEqual(
build_filters(
TestOrm, {"b": [UUID("06aa1e71-b025-4325-9983-4b3ce2de12ea")]}
),
("b eq '06aa1e71-b025-4325-9983-4b3ce2de12ea'", {}),
"handle UUID",
)
self.assertEqual(
build_filters(TestOrm, {"a": ["a"]}), (None, {"a": ["a"]}), "handle str"
)
self.assertEqual(
build_filters(TestOrm, {"a": [1, 2]}),
("(a eq 1 or a eq 2)", {}),
"multiple values",
)
self.assertEqual(
build_filters(TestOrm, {"a": ["b"], "c": ["d"]}),
(None, {"a": ["b"], "c": ["d"]}),
"multiple fields",
)
self.assertEqual(
build_filters(TestOrm, {"a": [1, 2], "c": [3]}),
("(a eq 1 or a eq 2) and c eq 3", {}),
"multiple fields and values",
)
self.assertEqual(
build_filters(
TestOrm,
{
"a": ["b"],
"b": [1],
"c": [UUID("06aa1e71-b025-4325-9983-4b3ce2de12ea")],
},
),
("b eq 1 and c eq '06aa1e71-b025-4325-9983-4b3ce2de12ea'", {"a": ["b"]}),
"multiple fields, types, and values",
)
self.assertEqual(
build_filters(TestOrm, {"d": [1, 2], "e": [3]}),
("(PartitionKey eq 1 or PartitionKey eq 2) and RowKey eq 3", {}),
"query on keyfields",
)
with self.assertRaises(ValueError):
build_filters(TestOrm, {"test1": ["b", "c"], "test2": ["d"]})
if __name__ == "__main__":
unittest.main()

View File

@ -0,0 +1,36 @@
#!/usr/bin/env python
#
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import json
import unittest
from pathlib import Path
from onefuzztypes.models import Report
from __app__.onefuzzlib.reports import parse_report
class TestReportParse(unittest.TestCase):
def test_sample(self) -> None:
report_path = Path(__file__).parent / "data" / "report.json"
with open(report_path, "r") as handle:
data = json.load(handle)
invalid = {"unused_field_1": 3}
report = parse_report(json.dumps(data))
self.assertIsInstance(report, Report)
with self.assertLogs(level="ERROR"):
self.assertIsNone(parse_report('"invalid"'))
with self.assertLogs(level="WARNING") as logs:
self.assertIsNone(parse_report(json.dumps(invalid)))
self.assertTrue(any(["unable to parse report" in x for x in logs.output]))
if __name__ == "__main__":
unittest.main()

View File

@ -0,0 +1,48 @@
#!/usr/bin/env python
#
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import unittest
from onefuzztypes.enums import (
Compare,
ContainerPermission,
ContainerType,
TaskFeature,
TaskType,
)
from onefuzztypes.models import ContainerDefinition, TaskDefinition, VmDefinition
from __app__.onefuzzlib.tasks.defs import TASK_DEFINITIONS
class TestTaskDefinition(unittest.TestCase):
def test_definitions(self) -> None:
for entry in TASK_DEFINITIONS.values():
self.assertIsInstance(entry, TaskDefinition)
TaskDefinition.validate(entry)
def test_all_defined(self) -> None:
for entry in [TaskType[x] for x in TaskType.__members__]:
self.assertIn(entry, TASK_DEFINITIONS)
def test_basic(self) -> None:
task_def_from_py = TaskDefinition(
features=[TaskFeature.target_exe, TaskFeature.target_env],
containers=[
ContainerDefinition(
type=ContainerType.inputs,
compare=Compare.AtLeast,
value=1,
permissions=[ContainerPermission.Read, ContainerPermission.Write],
)
],
monitor_queue=None,
vm=VmDefinition(compare=Compare.AtLeast, value=1),
)
TaskDefinition.validate(task_def_from_py)
if __name__ == "__main__":
unittest.main()