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

78 Коммитов

Автор SHA1 Сообщение Дата
Alan Jowett 16a951c2c3
Switch to hash table from AVL. Lock free in the presence of epoch allocator. (#389)
* Switch to hash table from AVL.
Lock free in the presence of epoch allocator.

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-08-20 18:29:11 -06:00
Dave Thaler c99a43e5e9
Revert "Remove dead code (#381)" (#401)
This reverts commit 7d779cf117.
2021-08-20 12:07:57 -07: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
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
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 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
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
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
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 a93f4ba714
program information serialization (#302)
* program information serialization.

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-06-28 16:47:34 -07: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
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
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 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 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 c59b072cd3
Add missing helperfunctions (#183)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-05-12 14:25:48 -07: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 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
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 927b2081e3
Update directory structure (#134)
Fixes #124

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