ubpf
ubpf copied to clipboard
Add libfuzzer based test with
This pull request introduces fuzzing capabilities to the project, including a new GitHub Actions workflow, and modifies the project's build system to support fuzzing. The most significant changes include the addition of the fuzzing.yml
workflow, the introduction of a new ubpf_fuzzer
executable, and the modification of the ubpf_vm
structure to include an instruction limit.
New GitHub Actions workflow:
-
.github/workflows/fuzzing.yml
: Added a new workflow to perform fuzzing. This workflow includes steps to build the project with fuzzing enabled, run the fuzzer, and upload any found artifacts.
Modifications to existing GitHub Actions workflow:
-
.github/workflows/main.yml
: Modified thepermissions
field to have write access to contents, changed thepush
andpull_request
branches tomain
from*
, and added a job to use the newfuzzing.yml
workflow. [1] [2] [3]
Changes to build system:
-
CMakeLists.txt
,cmake/options.cmake
,cmake/settings.cmake
: Added options to enable libfuzzer and coverage, and set compiler flags accordingly. [1] [2] [3]
New fuzzer executable:
-
libfuzzer/CMakeLists.txt
,libfuzzer/libfuzz_harness.cc
: Added a new executableubpf_fuzzer
that is built when fuzzing is enabled. This executable uses libfuzzer to fuzz the uBPF virtual machine. [1] [2]
Modifications to uBPF VM:
-
vm/inc/ubpf.h
,vm/ubpf_int.h
,vm/ubpf_vm.c
: Modified theubpf_vm
structure to include an instruction limit, added a method to set this limit, and modified theubpf_exec
function to respect this limit. Also, the bounds check function was updated for better error handling and reporting. [1] [2] [3] [4] [5] [6]