-
Notifications
You must be signed in to change notification settings - Fork 141
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
Reject BPF program if uninitialized stack or registers are accessed during interpret path #445
Conversation
d83a876
to
2491e7d
Compare
c62564d
to
9d46db6
Compare
02eef61
to
f9703df
Compare
Reject programs if registers are used before intialized Make undefined behavior check optional Signed-off-by: Alan Jowett <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really, really great!! I think that the infrastructure you have built around fuzzing and making it reproducible is going to really be very helpful!
Co-authored-by: Will Hawkins <[email protected]> Signed-off-by: Alan Jowett <[email protected]>
Signed-off-by: Alan Jowett <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!!
This pull request includes changes to improve the
ubpf
library. The most important changes include adding a new libfuzzer based fuzzer, modifying theLLVMFuzzerTestOneInput
function to compare the results of the interpreter and JIT compiler, adding a bash script to split the fuzzer input into a program and memory, and adding bounds checking for memory accesses.Improvements to fuzzing:
libfuzzer/README.md
: Added instructions for building and running a new libfuzzer based fuzzer.libfuzzer/libfuzz_harness.cc
: Modified theLLVMFuzzerTestOneInput
function to compare the results of the interpreter and JIT compiler, and to ensure the program length is a multiple ofsizeof(ebpf_inst)
. [1] [2]libfuzzer/split.sh
: Added a bash script to split the fuzzer input into a program and memory, and to disassemble the program.Improvements to disassembler:
ubpf/disassembler.py
: Modified thedisassemble_one
function to append " local" to the opcode name if the source register is 1. [1] [2]Improvements to JIT compiler:
vm/ubpf_jit_x86_64.c
: Added code to truncate the target register to 32 bits for ALU32 instructions.vm/ubpf_jit_x86_64.h
: Added theemit_truncate_u32
function to emit instructions to truncate a register to 32 bits.Improvements to VM:
vm/ubpf_vm.c
: Added bounds checking for memory accesses, and added checks to ensure registers are initialized before they are read. Also fixed a bug in theEBPF_OP_JEQ32_REG
instruction. [1] [2] [3] [4] [5] [6] [7] [8] [9]Resolves: #480