* remove --no-verify option from bpf2c and tests using it
Closes#3571
* remove builds for unsafe programs in sample.vcxproj
* remove unsafe test cases from netsh_test.cpp
* remove new noverify references
* Revert deletion of netsh tests.
* Add back compilation of unsafe programs (but not bpf2c call)
* remove invalid program tests which used noverify
* remove end_to_end tests using noverify
---------
Co-authored-by: Michael Agun <danielagun@microsoft.com>
* Move C++ hashing lib from tests/libs/util/ to libs/shared/
This puts hash.cpp/hash.h in a more central location for use by other project files.
* Set empty program name to hash of instructions
ebpf_program_load_bytes now hashes the instructions and uses that for the name
instead of generating a random number.
Closes#3443
* fix signed/unsigned warning (and ensure windows helper id >= 0)
* add bcrypt.dll dependency for ebpfapi.dll
* WIP new test case for ebpf_program_load_bytes with nullptr program name
* WIP ebpf_program_load_bytes testing
* truncate SHA256 hash to 63 bytes to stay under BPF_OBJ_NAME_LEN
* remove bcrypt from release dependencies and suppress analyze warning
* PR feedback - fix comment and bpf2c include paths
---------
Co-authored-by: Michael Agun <danielagun@microsoft.com>
Co-authored-by: Alan Jowett <alanjo@microsoft.com>
* Allow multiple programs per section
Temporarily use a fork of ebpf-verifier until
https://github.com/vbpf/ebpf-verifier/pull/642 is merged.
Per https://stackoverflow.com/questions/13147170/attribute-always-inline-failing
the __attribute__((always_inline)) doesn't do anything unless you also
have the "inline" keyword.
Signed-off-by: Dave Thaler <dthaler1968@gmail.com>
* Update verifier to latest
Signed-off-by: Dave Thaler <dthaler1968@gmail.com>
* Address comment from Alan
Signed-off-by: Dave Thaler <dthaler1968@gmail.com>
* Address API compat comment from Anurag
Signed-off-by: Dave Thaler <dthaler1968@gmail.com>
---------
Signed-off-by: Dave Thaler <dthaler1968@gmail.com>
* Add option to control the level of verbosity emitted by verifier.
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Re-order enums to make normal < informational < verbose
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Apply suggestions from code review
Co-authored-by: Dave Thaler <dthaler1968@gmail.com>
* PR feedback
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Workaround for verifier failure #643
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Revert change in ebpf-service verification path
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
---------
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
Co-authored-by: Alan Jowett <alan.jowett@microsoft.com>
Co-authored-by: Dave Thaler <dthaler1968@gmail.com>
* Update copyright to be eBPF for Windows contributors
Fixes#3507
Signed-off-by: Dave Thaler <dthaler1968@gmail.com>
* Undo gratuitous formatting changes in expected files
---------
Signed-off-by: Dave Thaler <dthaler1968@gmail.com>
* extension_header
* fix logic error.
* Re-purposing the size field to act as the "minor version". Additional validation checks are added.
* PR Feedback.
* fix break due to bad merge with PR #3372
* Clean up order of includes
Fixes#1963
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Update clang-format
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Clean up headers
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Update sort
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* FIx various build errors
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Fix ordering if including a .c file
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Fix cmake build
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* More header cleanup
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Update expected bpf2c output
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* More header fixes
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Update expected bpf2c output for custom bpf.c
The generate script does not handle this file.
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Fix tests
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Fix more expected bpf2c output
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
---------
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
Co-authored-by: Anurag Saxena <43585259+saxena-anurag@users.noreply.github.com>
Co-authored-by: Alan Jowett <alanjo@microsoft.com>
* Regenerate and checkin corpus files
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
* PR feedback
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
Co-authored-by: Alan Jowett <alan.jowett@microsoft.com>
Co-authored-by: Dave Thaler <dthaler@microsoft.com>
* Build ELF parse at compile time using EverParse
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* PR feedback
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Fix build
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
Co-authored-by: Alan Jowett <alan.jowett@microsoft.com>
* Mark unsafe strings via unsafe_string class
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Cleanup string handling
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Update expected output in tests
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Build break
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
Co-authored-by: Alan Jowett <alan.jowett@microsoft.com>
Co-authored-by: saxena-anurag <43585259+saxena-anurag@users.noreply.github.com>
* Encode all program info types
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
* Expand hard coded program types and helper functions
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
* Fix tail_call_map verification failure
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
* Fix tail_call_map verification failure
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
* Call ebpf_verifier prior to code gen
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
* Resovle failures after merge
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
* PR feedback
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
* Revert rollback of catch2
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
Co-authored-by: Dave Thaler <dthaler@microsoft.com>
* initial_commit
* fix build
* fix build
* fix build break due to merge
* debug build
* api changes, other changes
* bpf2c change to enmit program type, other fixes
* hydrate UM ebpf_object, other fixes
* remove logic to disable programs
* fixes
* fix sal
* build break
* build break
* fix sal errors
* fixes
* fix bpf2c_tests failure
* unload driver when program ref count becomes 0, other minor fixes
* fixes
* tail_call fixes, add test cases, other fixes
* build break
* build break
* code cleanup
* fix bad merge
* code cleanup
* code cleanup
* cleanup
* Apply suggestions from code review
Co-authored-by: Dave Thaler <dthaler@microsoft.com>
* cr comments
* Apply suggestions from code review
Co-authored-by: Dave Thaler <dthaler@microsoft.com>
* cr comments
* Apply suggestions from code review
Co-authored-by: Dave Thaler <dthaler@microsoft.com>
* cr comments
* cr comments
* Apply suggestions from code review
Co-authored-by: Dave Thaler <dthaler@microsoft.com>
* address cr comments
* Apply suggestions from code review
Co-authored-by: Dave Thaler <dthaler@microsoft.com>
* add tracing in ebpfcore, other fixes
* tracing
* add section for each map in sample
* do not delete the native service
* fix bad merge
* remove code to delete service, other fixes
* cr comments
* bpf2c should read and populate all the maps in ELF file
* add test case for creating map-in-map from native driver
* Apply suggestions from code review
Co-authored-by: Dave Thaler <dthaler@microsoft.com>
* cr comments
* add tracing for api code changes
* rename epbf_native_t to ebpf_native_module_t
* fix bad merge
Co-authored-by: Dave Thaler <dthaler@microsoft.com>
Add bpf2, a tool to generate C programs from eBPF instructions in an ELF file.
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
Co-authored-by: Dave Thaler <dthaler@microsoft.com>