* Add support for building ARM64 native only eBPF for Windows.
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* PR feedback
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>
* Centralize eBPF version to Directory.Build.props
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Remove unused and failing builds
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* PR feedback
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>
* Allow platform specific eBPF nuget packages to be created
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Specify version in output
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>
* 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>
* Stamp all tools with version information.
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Add commit id to nuget package
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Move versioning to Directory.Build.props
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Set correct project type in sample.vcxproj
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Add version info to fuzz tests
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* PR feedback
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Update tests/socket/resource.h
Co-authored-by: Dave Thaler <dthaler1968@gmail.com>
* Revert editor change
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>
* Add VS Clang to path
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Fix tests
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Reformat using clang 17.0.3
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Account for git_commit_id.h dependency
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Revert https://github.com/microsoft/ebpf-for-windows/pull/3756 from this branch
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Make LLVM path dependent on cl.exe path
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Use VCINSTALLDIR as root of LLVM path
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Update hash and set path to use environment variable
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>
* 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>
* Enable building and signing eBPF for Windows
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* PR feedback
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>
* 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>
* change ebpf_extension_header_t to ebpf_version_header_t
* revert to ebpf_version_header_t
* revert to ebpf_version_header_t
* update header
* update doc
* update doc
* use total_size to get the actual struct size
* Apply suggestions from code review
Co-authored-by: Dave Thaler <dthaler1968@gmail.com>
---------
Co-authored-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
* Add support for statically initializing BPF_MAP_TYPE_HASH_OF_MAPS
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Update installer and add code gen tests
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Add files to expected install list
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>
* Remove movsx imm instructions
Signed-off-by: Dave Thaler <dthaler1968@gmail.com>
* Switch most bpf2c uses to use verifier defines not uBPF defines
Signed-off-by: Dave Thaler <dthaler1968@gmail.com>
* Add bpf2c support for ja32 instruction
Signed-off-by: Dave Thaler <dthaler1968@gmail.com>
* Add bpf2c support for swap* instructions
Signed-off-by: Dave Thaler <dthaler1968@gmail.com>
* Add bpf support for movsx instructions
Signed-off-by: Dave Thaler <dthaler1968@gmail.com>
* Update CI/CD command
Signed-off-by: Dave Thaler <dthaler1968@gmail.com>
---------
Signed-off-by: Dave Thaler <dthaler1968@gmail.com>
* Add sdiv instruction support to bpf2c
Manually tested with latest bpf_conformance test
Signed-off-by: Dave Thaler <dthaler1968@gmail.com>
* Add signed modulo instructions
Signed-off-by: Dave Thaler <dthaler1968@gmail.com>
* Add sdiv conformance tests to isa-support table
Signed-off-by: Dave Thaler <dthaler1968@gmail.com>
* Fix ja32 documentation
Signed-off-by: Dave Thaler <dthaler1968@gmail.com>
---------
Signed-off-by: Dave Thaler <dthaler1968@gmail.com>
* Enable optimization on bpf2c generated code
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Fix optimization conflict with /rtc1
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Fix expected output for debug vs release
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>
* remove store km lib and code
* fix
* more cleanup
* Apply suggestions from code review
Co-authored-by: Dave Thaler <dthaler1968@gmail.com>
---------
Co-authored-by: Dave Thaler <dthaler1968@gmail.com>
* Fix build break from VS 2022 17.8.2
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Fix conflicting C++ versions
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* New depenedency on kernel32.dll
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Pickup latests usersim
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>
* replace XDP guids with XDP_TEST guids
* updated missde instance
* update bpf2c
* leave xdp_hook as is
* remove extra files
* update with new XDP_TEST guid, update other tests to use sample_ext
* update some tests, update test_helper
* update fuzzer
* temporarily remove bpftool tests
* update execution context test
* replace XDP guids with XDP_TEST guids
* updated missde instance
* update bpf2c
* leave xdp_hook as is
* remove extra files
* update with new XDP_TEST guid, update other tests to use sample_ext
* update some tests, update test_helper
* update fuzzer
* temporarily remove bpftool tests
* update execution context test
* build failures
* update sample ext with context_allocate and destroy
* update vm script to use xdp_test
* switch api tests to use sample program
* rename to xdp_Test
* update sample ext
* update incorrect SAL, update netsh tests
* update sample, update tests to use sample where applicable
* update tests
* fix up tests
* fix libbpf tets
* revert unnecessary changes
* remove extra prints
* add back in bpftool tests
* update to use xdp instead of xdp_test for bpftool test
* update atomic_instructions_others.o
* extra debug logs
* updated expected, update bpftool tests
* correct bpftool tests
* more debug logs
* add reg debug
* clear program info
* Attempt fix of buffer overrun
* remove debug logs, minor cleanup, set XDP guids back to their original names
* update docs with xdp_test
* fix guid usage
* CR: remove program, update comments, fix commented out tests, update bpf_program__attach_xdp
* revert changes in libbpf, as they need to use the actual XDP guids
* update comment
* update some XDP tests to use sample ext, comment out some expected failing tests
* update bpftool tests
* fix up bpf prog test run expected output, move to #if instead of comments
* fix up return code issue
* fix bpftool testes
* add some failed xdp tests, set some params to null for sample tests
* update comment
* tmp commit - move to xdp mock
* update unit tests to use mock XDP where possible
* made some samples back to XDP type
* netebpfext unit tests should use xdp_test
* CR
* build ebpfcore under usersim
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Work around analysis warnings
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Fix installer project
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Temporarily use ubpf branch with memory fix
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* WIP
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* WIP
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Create project for files shared between ebpfapi and the ebpf runtime
Move existing files from libs/platform either to:
* libs/shared, if meant to be common between user-mode and ebpf runtime
* libs/runtime, if meant to be used by the ebpf runtime only (whether in
user or kernel mode)
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Move ebpf_tracelog.c to shared
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Create shared_user and shared_kernel projects
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* WIP
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* WIP
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Remove usersim from ebpfsvc
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Update to cxplat branch of usersim
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Use cxplat_utf8_string
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Cleanup
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Fix build errors
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Fix ebpf_allocate_with_tag
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Fixes
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Bug fixes
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Fix use of ebpf_reallocate to not pass a null pointer
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Fix printf tests
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Fix memory leaks
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Temporary change to help debug double-free in test
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Update to latest usersim
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Fix analysis warnings
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Update to latest usersim
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Update usersim to latest
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Change native module to use latest usersim
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Update nuget package
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Only call cxplat_cleanup if cxplat_initialize succeeds
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Revert setup_build.vcxproj change
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Update usersim to latest
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
---------
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
Co-authored-by: Alan Jowett <alan.jowett@microsoft.com>
Other projects can now consume ebpf-for-windows in binary form,
using either nuget or MSI install. We no longer need to build
ebpf-for-windows both ways, so removing the cmake build to free
up build resources and reduce the development cost of maintaining
both msbuild and cmake builds.
Fixes#2743
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Implment bpf_get_prandom_u32 using linear congruential generator
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Add chi-squared test for randomness
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Fix test failure
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* PR feedback
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>
* Add static initializer support to bpf2c
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Fix tail call failure
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Fix test failures
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Fix test failures
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Fix parsing error
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Fix formatting for tail_call_sequential*.c
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Harden BTF data parsing
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* PR feedback and map init for native
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* Update tools/bpf2c/bpf_code_generator.cpp
Co-authored-by: Dave Thaler <dthaler@microsoft.com>
* Fix fault injection
Signed-off-by: Alan Jowett <alan.jowett@microsoft.com>
* PR feedback
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>
* Use usersim as DLL
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Convert usersim to a DLL
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Make cmake build clear program info state like VS build does
PR #1192 updated the vcxproj file but not the corresponding CMakeLists.txt file
for export_program_info
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Pick up latest usersim fix
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Fix deadlock in epoch_test_stale_items test
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Don't throw exceptions in unit tests
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Fix single instance hook initialization in test cases
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Fix deadlock in performance test
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
* Add usersim.dll to installer files
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
---------
Signed-off-by: Dave Thaler <dthaler@microsoft.com>