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

29 Коммитов

Автор SHA1 Сообщение Дата
Dave Thaler 7d145ebbc5
Add doxygen documentation on ebpf helpers (#325)
Before this change, the API docs at
https://microsoft.github.io/ebpf-for-windows/ebpf__helpers_8h.html
just show the typedefs.  This PR updates the documentation so that the
helpers are documented just like normal public APIs would be.

This is the first step towards addressing #259

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-06-30 14:24:02 -06:00
Dave Thaler e825caaa8e
Add doxygen documentation on enum values (#322)
* Make all enum values have a description in the generated API docs
* Also remove SAL annotation from the generated docs, since SAL
  breaks doxygen type detection

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

Co-authored-by: Alan Jowett <alanjo@microsoft.com>
2021-06-30 10:22:40 -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 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
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
saxena-anurag c31547cff5
Add ebpf public APIs - #1 (#290)
* add ebpf_program_load(), few other APIs
2021-06-22 20:42:18 -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
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
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
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
Dave Thaler 2bd9033b95
Fix doxygen errors (#229)
"git commit -am" only adds changes to existing files, not new files
and so was missing adding docs when new headers were added, resulting
in a failure.

Also some params were missing from doxygen which resulted in
a bunch of warnings.

Signed-off-by: Dave Thaler <dthaler@ntdev.microsoft.com>
2021-05-26 12:01:58 -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
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 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 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 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
saxena-anurag d724d3b079
Basic ebpfservice with RPC interface (#147)
* fix service based on new directory path
* fix x64 release build break
* add copyright headers
* cr comments
* address review comments
* cr comments, fix formatting
* Update comment
* Update comment

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-05-10 07:27:37 -07: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 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