Граф коммитов

234 Коммитов

Автор SHA1 Сообщение Дата
Dave Thaler c99a43e5e9
Revert "Remove dead code (#381)" (#401)
This reverts commit 7d779cf117.
2021-08-20 12:07:57 -07:00
Alan Jowett 6ac7be59a4
ebpf_program_t.links should be initialized (#395)
* Fix issue #394

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-08-20 11:04:32 -07:00
Alan Jowett da3b0a0cc1
Fix leak of ebpf_core_map_t.name.value (#393)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-08-20 11:02:21 -06:00
Dave Thaler 74c456e6b7
Update UM map APIs for libbpf compat (#388)
Since there is a name conflict between KM helpers and UM libbpf APIs,
the end-to-end tests need to _not_ include the KM helper prototypes,
so removed ebpf_helpers.h from ebpf.h and made samples include it
directly.

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-08-18 21:06:58 -07:00
Alan Jowett 184b1945d6
Adds support for querying per-CPU maps from user mode and returning a merged view of the per-CPU data (#384)
* Implement per-cpu maps using trivial option

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-08-17 17:22:32 -06:00
Shankar Seal 7d779cf117
Remove dead code (#381)
* Remove dead code

* Address PR feedback

Co-authored-by: Alan Jowett <alanjo@microsoft.com>
2021-08-13 14:56:36 -06:00
Alan Jowett e68dece71d
Explicit key and value lengths passed to map layer (#380)
* Explicit key and value lengths passed to map layer

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-08-13 13:13:16 -06:00
Alan Jowett 8cc5a7f5be
Add support for per-cpu hash and array maps - Part 1 (#378)
Add support for per-cpu hash and array maps

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-08-11 16:39:54 -06:00
Dave Thaler 7c12adb067
Prevent mismatched program types in PROG_ARRAY maps (#374)
* Prevent mismatched program types in PROG_ARRAY maps

* Each prog array map has a natural progtype, determined when
  asociating it from a program, or when adding the first program
  to it, if not associated with any program.
* Trying to add a program with mismatching type will fail
* Added libbpf bpf_create_map() API
* Fixed error returns from several libbpf APIs to be negative
* For efficiency, ebpf_program_get_properties now returns a
  pointer rather than copying the data inside the execution
  context, and is renamed to ebpf_program_get_parameters()
  to match what its return type always was.
* Fixed a bug in map size calculation that resulted in a huge
  amount of memory being allocated
* Updated return type of bpf_tail_call to the value meant
  to signal stack unwind needed

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-08-11 12:17:10 -07:00
saxena-anurag 014ee34392
Add eBPF UM APIs (#368)
* parse map names from elf file
* add apis, change test code

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-08-10 17:04:07 -07:00
Dave Thaler 8f46b4020f
Revert "Add code to propagate flags for helper functions. (#365)" (#366)
This reverts commit e9a565fd0a.
2021-08-09 14:37:40 -07:00
Alan Jowett e9a565fd0a
Add code to propagate flags for helper functions. (#365)
* Add code to propagate flags for helper functions.

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-08-09 13:33:31 -07:00
Dave Thaler 30246d0025
Fix return values from bpf_map_delete_elem etc helpers (#362)
Per https://github.com/iovisor/bpf-docs/blob/master/bpf_helpers.rst
negative numbers indicate failure.

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-08-09 09:41:15 -06:00
Shankar Seal be67121fda
Test Extension Part 2 (#361)
* Test Extension Part 2

* rename test extension to sample extension and update Getting-started doc.

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-08-07 14:19:00 -07:00
Alan Jowett 0fee94598b
Pull latest ubpf (#360)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-08-06 15:35:36 -07:00
Dave Thaler a321179cee
Add prog array map type and bpf_tail_call() helper (#359)
* Add prog array map type and bpf_tail_call()

This also fixes a bug where bpf_object__find_program_by_name
could only find the first program because program->object
was always null.

Also fixes tests to correctly use a signed int for what hooks return,
instead of an unsigned int.

Not done in this PR, but will be in a separate PR:
* make tail call replace stack frame instead of simply calling into the callee
* limit number of tail calls to 32
* require the same program type for caller and callee
* test with load byte array instead of from a file

Addresses part of #344

Signed-off-by: Dave Thaler <dthaler@microsoft.com>

* Address PR feedback

Signed-off-by: Dave Thaler <dthaler@microsoft.com>

* Address PR feedback

Signed-off-by: Dave Thaler <dthaler@microsoft.com>

* Add missing file

Signed-off-by: Dave Thaler <dthaler@microsoft.com>

* Disable warning due to C enum types used in C++

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-08-06 14:18:47 -06:00
Alan Jowett e706d82daa
Change bpf_map_update_elem to return result of insertion (#358)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-08-05 14:32:44 -06:00
Dave Thaler 2617349903
Remove duplicate public APIs where standard libbpf APIs exist (#356)
* Remove duplicate public APIs where standard libbpf APIs exist

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-08-03 17:25:50 -07:00
saxena-anurag 14248601d3
Add DETACH operation to detach a program from a hook. (#352)
* add UNLINK operation

* Some fixes:

1. Added attach_lock to synchronize multiple detach calls on same link object.
2. ebpf_extension_unload() should be called from ebpf_link_detach_program()
3. Changed return type of ebpf_program_get_properties to void.

* Update libs/execution_context/ebpf_program.c

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-07-30 17:17:16 -07:00
Dave Thaler 8006f181e0
Libbpf API compatibility (#350)
* 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>
2021-07-30 15:34:21 -07:00
Alan Jowett 4bebd3aaa1
Verify that program type is supported by attach provider (#348)
* Verify that program type is supported by attach provider

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-07-27 16:33:58 -07:00
Shankar Seal 18456999b7
move map helper function prototypes to EC (#337)
* move map helper function prototypes to EC
* replace 'generic' by 'general'

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-07-22 15:31:01 -07:00
Shankar Seal 266578ee63
test extension - Part 1 (#336)
* test extension
2021-07-14 14:40:34 -07:00
Dave Thaler 4d0ac1bd4d
Replace "information" with "info" for consistency (#331)
Previously some places had "info" and some had "information".
Both appear in dictionaries, so guidance to avoid abbreviations does not apply.

Fixes #314

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-07-07 11:16:35 -07:00
Dave Thaler 569da02a8f
Add main API reference page (#329)
Which will fill in content visible at https://microsoft.github.io/ebpf-for-windows/

Fixes #259

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-07-07 10:39:59 -07:00
Alan Jowett 9681a918ad
Fix issues flagged by CodeQL code scan (#324)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-06-30 11:11:27 -06:00
Shankar Seal f96522ecd4
fix sal on safeint functions (#321)
* fix sal on safeint functions

Co-authored-by: Alan Jowett <alanjo@microsoft.com>
2021-06-29 21:42:40 -07:00
Alan Jowett 0cf75fef7d
Fix C6386 warning in ebpf_epoch_initiate (#320)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-06-29 17:13:13 -06:00
Dave Thaler d8a26f2b6d
Revert C6011 override (#319)
Fixes #309

Signed-off-by: Dave Thaler <dthaler@microsoft.com>

Co-authored-by: Alan Jowett <alanjo@microsoft.com>
2021-06-29 16:39:03 -06:00
Alan Jowett 7870921e02
Additional analysis fixes (#315)
* Fix C26110,C28023,C28193,C6001,C6031,C6054
* Fix C6101

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-06-29 15:51:41 -06:00
Shankar Seal a93f4ba714
program information serialization (#302)
* program information serialization.

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-06-28 16:47:34 -07:00
Alan Jowett a0801d410c
Suppress C26451 (#312)
* Suppress C26451 and related errors

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-06-28 16:13:29 -07:00
Alan Jowett a7e7b69661
C6387 fixes (#311)
* C6387 fixes

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-06-25 16:02:05 -06:00
Alan Jowett 9d798031b4
Fix warnings due to C6011 - NULL pointer deref (#307)
* 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>
2021-06-25 10:24:03 -06:00
Alan Jowett 7101b164bd
Fix inconsistent annotation (#303)
* Fix inconsistent annotation

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Suppress mismatched annotation from ntintsafe.h

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Fix annotation

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Fix inconsistent annotation

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Suppress wrong annotation from ntintsafe.h

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Fix annotation

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Revert incorrect SAL change

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-06-24 16:39:27 -06:00
Dave Thaler 5a5dbc63a7
Add additional netsh tests (#298)
Fix a couple bugs that the tests uncovered
Remove duplicate "error: error:" prefix in messages on verification

Fixes #240

Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>

Co-authored-by: Alan Jowett <alanjo@microsoft.com>
2021-06-23 19:12:20 -06:00
saxena-anurag b0bb08907b
add execution type to ebpf_program_load() (#297)
* add execution type to ebpf_program_load()

* cr comments
2021-06-23 18:54:03 -06:00
Dave Thaler 360aa224ea
Add some netsh tests (#295)
Adds tests for "show sections" and "show disassembly"

Addresses part of issue #240

Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
2021-06-23 09:54:36 -07:00
saxena-anurag c31547cff5
Add ebpf public APIs - #1 (#290)
* add ebpf_program_load(), few other APIs
2021-06-22 20:42:18 -07:00
Alan Jowett 3027b82df0
Unify unit tests (#294)
* Unify unit tests

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-06-22 12:22:50 -06:00
Dave Thaler dc157726da
Add some more SAL annotations and clean up some code analysis warnings (#277)
* Make a couple of `_In_` arguments be const
* Add `_opt_` to a number of arguments that can be NULL
* Add SAL annotation to a few more APIs that were missing it
* Remove annotations like
  `_Pre_readable_byte_size_(hash_table->key_size)` since they just give
  code analysis warnings such as:
  ```
  c:\git\dthaler\ebpf-for-windows\libs\platform\ebpf_platform.h(445):
  warning C28230: The type of '_Param_(1)' has no member 'key_size'.
  c:\git\dthaler\ebpf-for-windows\libs\platform\ebpf_platform.h(445):
  warning C28285: For function 'ebpf_hash_table_delete' '_Param_(2)'
  syntax error in
  'SAL_readableTo(byteCount(__formal(0,hash_table)->key_size))' near
  'key_size))'.
  ```

Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
2021-06-16 13:27:22 -07:00
Dave Thaler 2200ab915f
Merge eBPF types with the types in ebpf-verifier (#282)
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>
2021-06-16 11:53:21 -07:00
Dave Thaler a46b00c2e3
Add VM setup scripts and docs (#281)
* 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>
2021-06-15 08:44:43 -07:00
Alan Jowett 9e8b88a41a
Switch to approved license header format (#268)
* Switch to approved license header format

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-06-10 12:02:00 -07:00
Alan Jowett 877cb22ec0
First pass of adding SAL annotations (#253)
* First pass of adding SAL annotations

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Finish annotating platform

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Cleanup annotation to get lock tracking work correctly

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback and fix static analysis issues

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Fix build break from merge

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-06-10 10:45:23 -06:00
Shankar Seal 613ee57092
Core review comments from PR 246 (#261)
Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-06-09 20:28:23 -07:00
Dave Thaler 6be20d7aad
Simplify names of some ebpf_result codes (#256)
* Simplify names of some ebpf_result codes

* Remove _ERROR_ for consistency
* Combine EBPF_INVALID_HANDLE and EBPF_INVALID_OBJECT
* Rename EBPF_ERROR_NOT_FOUND to EBPF_KEY_NOT_FOUND for consistency with the associated description.
* Change code that returned EBPF_ERROR_NOT_FOUND for a case other than a
key, to use a different appropriate result, so the description stays correct.

Fixes #212

Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
2021-06-09 19:32:57 -07:00
Shankar Seal 27f8d49888
API to create map and enumerate all pinned maps. (#246)
* API to create map and enumerate all pinned maps.

* Apply suggestions from code review

Co-authored-by: Dave Thaler <dthaler@microsoft.com>

* Address code review comments

* Address code review comments #2

* Address code review comments #3

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
Co-authored-by: Alan Jowett <alanjo@microsoft.com>
2021-06-09 09:44:24 -06:00
Alan Jowett a69d6f55ad
Synchronize client detach and hook invocation (#255)
* Synchonize client detach and hook invocation

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Check for detached program before invoking

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-06-09 09:17:50 -06:00
Alan Jowett 4e4c19314f
Remap helper_ids to range [0,63] (#252)
* Remap helper_ids to range [0,63]

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-06-08 15:33:00 -06:00
saxena-anurag cf2ef87325
Move program load to ebpfsvc (#245)
* remove duplicate windows_helpers.cpp, refactor

* remove commented code

* move program load to service

* cleanup commented code

* remove commented code

* cr comments

* make device handle init optional

* cr comments

* change return type of some functions

* fix

* cr comments

* cr comments, cover more error conditions in windows_error_to_ebpf_result

* cr comments

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
Co-authored-by: Alan Jowett <alanjo@microsoft.com>
2021-06-07 15:22:04 -06:00
Alan Jowett 7e033f0200
Remove allocations from executable memory pool (#251)
* Remove allocations from executable memory pool

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Add direction to doxygen

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Clarify use of 4096 as page size

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-06-07 14:07:24 -06:00
Dave Thaler bf7eef76c5
Make netsh "show verification" command display max instruction count (#242)
Fixes #193

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-06-02 12:22:06 -06:00
Dave Thaler 50a773d8dc
Fix bugs in netsh helper (#238)
* Pinning a program requires a name to pin to
* The load program API doesn't correctly deal with an empty section name
  (it does use the first section but then tells the execution context
  that the section name is empty instead of the chosen one), so for now
  require the section name in any "add program" command
* Allow netsh to hold references on multiple programs
* Fix handle leak in "show programs"
* Implement ability to pin a program, but unpinning requires
  a way to look up what a program was pinned to, and no such
  API exists currently.
* Implement filtering "show programs" output by filename and section

Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>

Co-authored-by: Alan Jowett <alanjo@microsoft.com>
2021-06-01 09:47:26 -06:00
Alan Jowett b5ee7c7259
Make JIT code pages read-only (#233)
* Add LLVM for code generation proposal

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Revert "Add LLVM for code generation proposal"

This reverts commit cd896afd94.

* Free program object on epoch end

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Fix log function

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Workaround for VS2019 update 16.10.0

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Use correct API to map pages to system va

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback & verifier bug fixes

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-05-28 16:59:08 -06:00
saxena-anurag 3a8e5dd7cd
remove duplicate windows_helpers.cpp, refactor (#236)
* remove duplicate windows_helpers.cpp, refactor

* remove commented code

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-05-28 15:29:41 -07:00
Alan Jowett 466e925e91
Add support for running work-item on epoch end (#231)
* Add LLVM for code generation proposal

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Revert "Add LLVM for code generation proposal"

This reverts commit cd896afd94.

* Add support for running work-item on epoch end

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-05-27 15:41:26 -06:00
Alan Jowett 4c64214af7
Change resolve_maps_in_byte_code to send handles for resolution only when needed. (#230)
* Add LLVM for code generation proposal

* Revert "Add LLVM for code generation proposal"

This reverts commit cd896afd94.

* Eliminate duplicate map resolutions

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-05-27 13:56:06 -07:00
Alan Jowett 4b53d101aa
Add support for allocating pages for code that can be marked read/execute (#228)
* Add LLVM for code generation proposal

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Revert "Add LLVM for code generation proposal"

This reverts commit cd896afd94.

* Work in progress

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Add doxygen

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* PR feedback

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-05-26 14:37:04 -06:00
Dave Thaler d37e65801a
Fix netsh display of program type (#226)
Since the program type changed from int to GUID the display has been
broken (it displays a useless pointer value).  This fix makes it display
the string name of the type.

Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
2021-05-25 22:05:03 -07:00
Dave Thaler e9e7133deb
Remove duplicate copy of helper prototypes from verifier (#220)
Fixes #67

Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
2021-05-25 16:22:29 -07:00
Dave Thaler faebbdd32a
Clean up compiler warnings (#225)
The IDL was generating MIDL2279 because it used const on an [out] param,
which is warned against since RPC marshaling copies the result into new
memory.  See https://marc.info/?l=ms-dcom&m=103440617317922 for some
discussion.

Other changes should hopefully be obvious.

Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
2021-05-25 15:36:19 -07:00
saxena-anurag 4b2384479d
refactor api.lib to api.lib, common.lib, service.lib (#219)
* refactor api.lib to api.lib, common.lib, service.lib

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-05-25 14:11:13 -07:00
saxena-anurag 2518e84e84
Integrate verifier with ebpfsvc (#198)
* call verifier from svc
* ebpfsvc verification support, rpc client
* change rpc api to take const char*, review comments
2021-05-20 18:04:36 -07:00
Dave Thaler 773b27d2c0
Merge error codes from ebpf_windows.h into ebpf_result_t (#210)
Fixes #151

Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
2021-05-20 12:38:58 -07:00
Alan Jowett d765bd616d
Increase stack size for eBPF programs to 512 bytes (#197)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-05-14 10:17:26 -06:00
Alan Jowett d95e3d22eb
Document why we disable bounds check when using uBPF (#195)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-05-13 08:56:36 -07:00
Alan Jowett 19bbe366e8
Add prerequisite code for applying access check to pinning operations (#185)
* Add prerequisite code for applying access check to pinning operations

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-05-12 19:57:28 -06:00
Alan Jowett c59b072cd3
Add missing helperfunctions (#183)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-05-12 14:25:48 -07:00
theidexisted 2b2ea62dee
Minor fix, save a constructor (#165)
Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-05-12 04:54:00 -07:00
Alan Jowett 38dae7294d
Switch to using https://github.com/iovisor/ubpf as the upstream branch for ubpf (#178)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-05-11 20:48:32 -07:00
Alan Jowett 1aedf620fc
Modify EBPF_OPERATION_GET_PROGRAM_INFORMATION to accept ebpf_program_type_t (#175)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-05-11 18:25:11 -07:00
Alan Jowett 25f6253fb1
Eliminate need for _unwind_helper (#174)
* Eliminate need for _unwind_helper

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Fix build break

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-05-11 17:16:30 -06:00
Alan Jowett 1af5e65f65
Switch ebpf_program_type_descriptor_t::platform_specific_data to GUID (#171)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-05-11 14:46:00 -06:00
Alan Jowett bf6cb270ac
Update driver to return ebpf_program_data_t to verifier (#163)
* Update driver to return ebpf_program_data_t to verifier

Signed-off-by: Alan Jowett <alanjo@microsoft.com>

* Fix typo in comment

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-05-11 09:53:12 -07:00
Alan Jowett 962ef5e03d
Split tests (#158)
* Create unit test for execution context
* Split out platform unit tests
* Call UT as part of CI/CD pipeline

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-05-10 15:14:49 -06:00
Dave Thaler a022da91cb
Fix README.md (#157)
HVCI requires the guest OS to enforce it so doesn't apply to Linux

Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
2021-05-10 10:03:14 -07:00
Alan Jowett c47617951a
Split public and internal headers (#154)
* Split public and internal headers

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-05-10 09:47:54 -06:00
Alan Jowett d9c8dc45a1
First draft of code to serialize EBPF program info (#152)
* First draft of code to serialize EBPF program info
* Add code to encode program information from extension

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-05-10 07:07:43 -07:00
Dave Thaler 7a34bb0c86
Make verifier and netsh use GUIDs instead of int program types (#150)
Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
2021-05-08 10:45:50 -06:00
Dave Thaler 0f7a6b0c12
Update to latest verifier version (#148)
Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
2021-05-07 17:02:54 -07:00
Dave Thaler b2a41eae21
Put hook and helper APIs in common headers (#142)
Fixes #138

Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
2021-05-06 13:47:09 -07:00
Alan Jowett 40d8633277
Add support for having provider helper function address change on reload of a provider (#135)
* Add support for notifying on provider change
* Build trampoline functions for relocation of provider helper functions

Resolves: #135 
Resolves: #133 

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-05-05 18:24:09 -06:00
Dave Thaler 927b2081e3
Update directory structure (#134)
Fixes #124

Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
2021-05-05 14:10:28 -06:00