Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add libfuzzer based test with #443

Merged
merged 9 commits into from
May 6, 2024
Merged

Conversation

Alan-Jowett
Copy link
Collaborator

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 the permissions field to have write access to contents, changed the push and pull_request branches to main from *, and added a job to use the new fuzzing.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 executable ubpf_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 the ubpf_vm structure to include an instruction limit, added a method to set this limit, and modified the ubpf_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]

Alan Jowett and others added 3 commits May 5, 2024 15:13
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
@Alan-Jowett Alan-Jowett requested a review from hawkinsw May 5, 2024 23:37
Alan Jowett added 2 commits May 6, 2024 08:08
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
@coveralls
Copy link

coveralls commented May 6, 2024

Coverage Status

coverage: 81.235%. first build
when pulling 0d4af14 on Alan-Jowett:fuzz_test
into 664410c on iovisor:main.

Alan Jowett added 2 commits May 6, 2024 10:49
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
Copy link
Collaborator

@hawkinsw hawkinsw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just wanted to ask a few questions!

libfuzzer/libfuzz_harness.cc Show resolved Hide resolved
vm/inc/ubpf.h Outdated Show resolved Hide resolved
vm/inc/ubpf.h Show resolved Hide resolved
vm/ubpf_vm.c Show resolved Hide resolved
vm/ubpf_vm.c Show resolved Hide resolved
vm/ubpf_vm.c Show resolved Hide resolved
Alan Jowett and others added 2 commits May 6, 2024 12:40
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
Copy link
Collaborator

@hawkinsw hawkinsw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry -- one more go around!

vm/inc/ubpf.h Show resolved Hide resolved
vm/inc/ubpf.h Show resolved Hide resolved
vm/ubpf_vm.c Show resolved Hide resolved
vm/ubpf_vm.c Show resolved Hide resolved
Copy link
Collaborator

@hawkinsw hawkinsw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Alan-Jowett Alan-Jowett enabled auto-merge (squash) May 6, 2024 20:55
@Alan-Jowett Alan-Jowett disabled auto-merge May 6, 2024 21:45
@Alan-Jowett Alan-Jowett merged commit 0a50b44 into iovisor:main May 6, 2024
34 checks passed
@Alan-Jowett Alan-Jowett deleted the fuzz_test branch May 6, 2024 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants