Skip to content

Commit

Permalink
Add core helper and bpf2c fuzzers to CI/CD
Browse files Browse the repository at this point in the history
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
  • Loading branch information
dthaler committed May 31, 2022
1 parent 9e331b7 commit 7b34a28
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cicd.yml
Expand Up @@ -174,7 +174,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
Expand Down
8 changes: 8 additions & 0 deletions 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 <output_directory>

set OUTPUTPATH=%1
xcopy /d /i /y "%OUTPUTPATH%\*.o" "%OUTPUTPATH%\bpf2c_fuzzer_corpus"
9 changes: 9 additions & 0 deletions 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 <solution_path> <output_directory>

set SOLUTIONPATH=%1
set OUTPUTPATH=%2
xcopy /d /i /y "%SOLUTIONPATH%\tests\libfuzzer\core_helper_fuzzer\corpus" "%OUTPUTPATH%"
10 changes: 5 additions & 5 deletions scripts/create_verifier_corpus.bat
Expand Up @@ -6,8 +6,8 @@ rem Usage: create_verifier_corpus.bat <solution_path> <output_directory>

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%"
2 changes: 1 addition & 1 deletion tests/libfuzzer/README.md
Expand Up @@ -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.
Expand Down
11 changes: 10 additions & 1 deletion tests/libfuzzer/core_helper_fuzzer/core_helper_fuzzer.vcxproj
Expand Up @@ -87,7 +87,16 @@
<Project>{245f0ec7-1ebc-4d68-8b1f-f758ea9196ae}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="..\..\..\scripts\create_core_helper_corpus.bat">
<FileType>Document</FileType>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)core_helper_corpus\bpf_tail_call</Outputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)core_helper_corpus\bpf_tail_call</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(SolutionDir)scripts\create_core_helper_corpus.bat $(SolutionDir) $(OutDir)core_helper_corpus</Command>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(SolutionDir)scripts\create_core_helper_corpus.bat $(SolutionDir) $(OutDir)core_helper_corpus</Command>
</CustomBuild>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
</Project>
Expand Up @@ -23,4 +23,9 @@
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
<ItemGroup>
<CustomBuild Include="..\..\..\scripts\create_core_helper_corpus.bat">
<Filter>Source Files</Filter>
</CustomBuild>
</ItemGroup>
</Project>

0 comments on commit 7b34a28

Please sign in to comment.