* Libbpf API compatibility
Libbpf is incorporated as a submodule just for the header file.
As discussed in issue #84, we cannot currently use the implementation
since it is very Linux and GCC specific.
This PR also fixes a bug where the user-mode API was calling
CloseHandle directly instead of Platform::CloseHandle which is needed
to make tests work with the mock platform.
Addresses #84
Some code will be cleaner once issue #81 is done
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
Includes support for marking a helper as doing packet reallocation
Signed-off-by: Dave Thaler <dthaler@microsoft.com>
Co-authored-by: Alan Jowett <alanjo@microsoft.com>
* Switch from _Pre_maybenull_ to _In_opt_
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
* Fix C6011
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
* Fix C6011 in PreprocessCommand
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
Remove duplicate types:
* ebpf_helper_return_type_t
* ebpf_helper_argument_type_t
* ebpf_context_descriptor_t
https://github.com/vbpf/ebpf-verifier/pull/238 already made the
necessary changes in the PREVAIL project, which got rid of the
issue with VOID and so the 'undef VOID' workarounds are removed
in the present PR.
Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
* Create an install script rather than having to manually do lots
of steps
* Make Debug build use vcruntime as static libs to avoid adding
another prerequisite on a machine before installing eBPF. This
isn't required for Release builds as vcruntime release DLLs
are part of Windows, unlike vcruntime debug DLLs
Fixes#248
Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
* Pickup changes from upstream ubpf
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
* Add ebpf_handle_kernel.c to interface with Windows object manager to manage lifetimes.
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
* PR feedback
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
Pick up change to ebpf-verifier that potentially shaves a couple of minutes off the time needed for a CI pass
Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
The instruction count is shown twice, with both numbers incorrect.
This PR fixes the first one.
The second one comes from the stats section which is off by one since it
counts "entry:", which is also why the Prevail "check" tool skips
printing it. I'm following up separately to see if that one can just be removed.
Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
Update ebpf to use minimally changed ubpf
1) Revert change in ubpf to support dynamic map and helper resolution -> pre-resolve all maps and helpers.
2) Remove jitter code from kernel ubpf lib
Moves Windows platform files into the internal repo.
Also adds ebpf_windows.h file to centralize defines that were previously
duplicated in at least three places.
Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>