diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 5d7bd7f95b..61294d2f87 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -152,20 +152,18 @@ jobs: code_coverage: false gather_dumps: true - # TODO: Enable this once a corpus is available. - # - #bpf2c_fuzzer: - # needs: libfuzzer - # # Always run this job. - # if: github.event_name == 'schedule' || github.event_name == 'pull_request' - # uses: ./.github/workflows/reusable-test.yml - # with: - # name: bpf2c_fuzzer - # test_command: bpf2c_fuzzer.exe bpf2c_fuzzer_corpus -use_value_profile=1 -max_total_time=1800 - # build_artifact: Build-x64-fuzzer - # environment: windows-2019 - # code_coverage: false - # gather_dumps: true + bpf2c_fuzzer: + needs: libfuzzer + # Always run this job. + if: github.event_name == 'schedule' || github.event_name == 'pull_request' + uses: ./.github/workflows/reusable-test.yml + with: + name: bpf2c_fuzzer + test_command: bpf2c_fuzzer.exe bpf2c_fuzzer_corpus -use_value_profile=1 -max_total_time=1800 + build_artifact: Build-x64-fuzzer + environment: windows-2019 + code_coverage: false + gather_dumps: true core_helper_fuzzer: needs: libfuzzer @@ -174,7 +172,7 @@ jobs: uses: ./.github/workflows/reusable-test.yml with: name: core_helper_fuzzer - test_command: core_helper_fuzzer ..\..\tests\libfuzzer\core_helper_fuzzer\corpus -max_len=139 -runs=3000 -use_value_profile=1 + test_command: core_helper_fuzzer core_helper_corpus -max_len=139 -runs=3000 -use_value_profile=1 build_artifact: Build-x64-fuzzer environment: windows-2019 code_coverage: false diff --git a/scripts/create_bpf2c_corpus.bat b/scripts/create_bpf2c_corpus.bat new file mode 100644 index 0000000000..605ef11827 --- /dev/null +++ b/scripts/create_bpf2c_corpus.bat @@ -0,0 +1,8 @@ +@echo off +rem Copyright (c) Microsoft Corporation +rem SPDX-License-Identifier: MIT +rem +rem Usage: create_bpf2c_corpus.bat + +set OUTPUTPATH=%1 +xcopy /d /i /y "%OUTPUTPATH%\*.o" "%OUTPUTPATH%\bpf2c_fuzzer_corpus" diff --git a/scripts/create_core_helper_corpus.bat b/scripts/create_core_helper_corpus.bat new file mode 100644 index 0000000000..b1384dbd22 --- /dev/null +++ b/scripts/create_core_helper_corpus.bat @@ -0,0 +1,9 @@ +@echo off +rem Copyright (c) Microsoft Corporation +rem SPDX-License-Identifier: MIT +rem +rem Usage: create_core_helper_corpus.bat + +set SOLUTIONPATH=%1 +set OUTPUTPATH=%2 +xcopy /d /i /y "%SOLUTIONPATH%\tests\libfuzzer\core_helper_fuzzer\corpus" "%OUTPUTPATH%" diff --git a/scripts/create_verifier_corpus.bat b/scripts/create_verifier_corpus.bat index 0bacc8966d..2cef6bc88f 100644 --- a/scripts/create_verifier_corpus.bat +++ b/scripts/create_verifier_corpus.bat @@ -6,8 +6,8 @@ rem Usage: create_verifier_corpus.bat set SOLUTIONPATH=%1 set OUTPUTPATH=%2 -xcopy /d /s /i /y %SOLUTIONPATH%\external\ebpf-verifier\ebpf-samples\build "%OUTPUTPATH%" -xcopy /d /s /i /y %SOLUTIONPATH%\external\ebpf-verifier\ebpf-samples\invalid "%OUTPUTPATH%" -xcopy /d /s /i /y %SOLUTIONPATH%\external\ebpf-verifier\ebpf-samples\linux "%OUTPUTPATH%" -xcopy /d /s /i /y %SOLUTIONPATH%\external\ebpf-verifier\ebpf-samples\prototype-kernel "%OUTPUTPATH%" -xcopy /d /s /i /y %SOLUTIONPATH%\external\ebpf-verifier\ebpf-samples\suricata "%OUTPUTPATH%" +xcopy /d /i /y "%SOLUTIONPATH%\external\ebpf-verifier\ebpf-samples\build" "%OUTPUTPATH%" +xcopy /d /i /y "%SOLUTIONPATH%\external\ebpf-verifier\ebpf-samples\invalid" "%OUTPUTPATH%" +xcopy /d /i /y "%SOLUTIONPATH%\external\ebpf-verifier\ebpf-samples\linux" "%OUTPUTPATH%" +xcopy /d /i /y "%SOLUTIONPATH%\external\ebpf-verifier\ebpf-samples\prototype-kernel" "%OUTPUTPATH%" +xcopy /d /i /y "%SOLUTIONPATH%\external\ebpf-verifier\ebpf-samples\suricata" "%OUTPUTPATH%" diff --git a/tests/libfuzzer/README.md b/tests/libfuzzer/README.md index 9efe5c5644..f0a29b979f 100644 --- a/tests/libfuzzer/README.md +++ b/tests/libfuzzer/README.md @@ -15,7 +15,7 @@ There are now four libFuzzer-based binaries: 1) Copy the libFuzzer binary and existing corpus to a test machine (currently only Windows 10 and Server 2019 are supported). 2) Start the libFuzzer binary, pass the path to the corpus folder, and maximum time to run: * `bpf2c_fuzzer.exe bpf2c_fuzzer_corpus -use_value_profile=1 -max_total_time=1800` - * `core_helper_fuzzer.exe core_helper_fuzzer ..\..\tests\libfuzzer\core_helper_fuzzer\corpus -max_len=139 -runs=3000 -use_value_profile=1` + * `core_helper_fuzzer.exe core_helper_fuzzer core_helper_corpus -max_len=139 -runs=3000 -use_value_profile=1` * `execution_context_fuzzer.exe execution_context_fuzzer_corpus -use_value_profile=1 -max_total_time=1800` * `verifier_fuzzer.exe verifier_corpus -use_value_profile=1 -max_total_time=1800` 3) If the fuzzer hits an issue, it will display the stack trace and create a file containing the input that triggered the crash. diff --git a/tests/libfuzzer/core_helper_fuzzer/core_helper_fuzzer.vcxproj b/tests/libfuzzer/core_helper_fuzzer/core_helper_fuzzer.vcxproj index a48a748479..8389801d78 100644 --- a/tests/libfuzzer/core_helper_fuzzer/core_helper_fuzzer.vcxproj +++ b/tests/libfuzzer/core_helper_fuzzer/core_helper_fuzzer.vcxproj @@ -87,7 +87,16 @@ {245f0ec7-1ebc-4d68-8b1f-f758ea9196ae} + + + Document + $(OutDir)core_helper_corpus\bpf_tail_call + $(OutDir)core_helper_corpus\bpf_tail_call + $(SolutionDir)scripts\create_core_helper_corpus.bat $(SolutionDir) $(OutDir)core_helper_corpus + $(SolutionDir)scripts\create_core_helper_corpus.bat $(SolutionDir) $(OutDir)core_helper_corpus + + - + \ No newline at end of file diff --git a/tests/libfuzzer/core_helper_fuzzer/core_helper_fuzzer.vcxproj.filters b/tests/libfuzzer/core_helper_fuzzer/core_helper_fuzzer.vcxproj.filters index 00f5bcbaec..73656b2679 100644 --- a/tests/libfuzzer/core_helper_fuzzer/core_helper_fuzzer.vcxproj.filters +++ b/tests/libfuzzer/core_helper_fuzzer/core_helper_fuzzer.vcxproj.filters @@ -23,4 +23,9 @@ Source Files - + + + Source Files + + + \ No newline at end of file