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

389 Коммитов

Автор SHA1 Сообщение Дата
Alan Jowett 967990f700
Disable /ZI and incremental linking (#546)
* Disable /ZI and incremental linking

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-16 16:49:02 -06:00
Alan Jowett 1393901505
CodeQl pipeline should run daily, not on every PR (#547)
* CodeQl pipeline shoud run daily, not on every PR

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-16 10:41:14 -06:00
Alan Jowett 488a4bf6d3
Switch to SHA256 digest algorithm (#550)
* Switch to SHA256 digest algorithm

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-16 10:24:45 -06:00
Dave Thaler 872999db06
Add netsh capability to unpin programs (#539)
* Add netsh capability to unpin programs

* The netsh "set program id=<id> pinned=" (with no value) will now unpin a
  program from all paths
* The netsh "delete program <id>" will now unpin a program from all
  paths before and releasing any reference held by netsh itself
* Make the "attached=<string>" argument to netsh set programs work
  with a section name like string
* Add libbpf api bpf_obj_get()
* Add ebpf_get_next_pinned_program_name() API to enumerate pinned
  programs

Fixes #190 #373

This is required for #188 which will update the "show programs"
and also add an option to "add program" to pin all programs rather
than just the first one in a file, like bpftool has such an option.

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

* Update mock netsh behavior since PR 540 changed the underlying requirements

PreprocessCommand now correctly matches tags so you can specify a later
optional tag without having to specify earlier optional tags

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-09-15 18:40:44 -07:00
Alan Jowett 6ae5c349dc
Only run performance tests on release (#543)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-15 14:29:19 -06:00
Dave Thaler aa09128ae0
Add libpf's libbpf_prog_type_by_name() API (#534)
* Add libpf's libbpf_prog_type_by_name() API

And add an ebpf_get_program_type_by_name() that returns the GUIDs
instead of ints.

This also removes the hard-coding of GUIDs or ints from the netsh
helper.

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-09-15 12:08:18 -07:00
Alan Jowett 7b9b6a7b1a
Fail link initialize if loading extension fails (#540)
* Fail link initialize if loading extension fails

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-15 12:11:13 -06:00
Alan Jowett 30011f0174
Remove unneeded manual download of boost (#541)
* Remove unneeded manual download of boost

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-15 11:42:30 -06:00
Alan Jowett 36784bbac4
Provide blurb to explain how pinning table works (#538)
* Provide blurb to explain how pinning table works

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-15 10:21:06 -07:00
Alan Jowett 9102f1e8c4
Remove reference to MSVC Runtime from docs as it is no longer needed (#529)
* Remove reference to MSVC Runtime from docs as it is no longer needed

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-09-14 18:45:33 -06:00
Alan Jowett cc9d0b06cc
First unregister for callouts, then unregister the provider (#532)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-09-14 15:48:56 -06:00
Alan Jowett 56a8d19c8b
Revert fix for #530 as it breaks ci/cd pipeline (#536)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-14 14:41:54 -06:00
Alan Jowett 48d31c2c37
Cache symbols of drivers loaded on kernel CI/CD machine (#533)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-14 13:20:43 -06:00
Dave Thaler 12bb2e7195
Update netsh commands to use more standard libbpf apis (#527)
* Update netsh commands to use more standard libbpf apis

* Add support for libbpf bpf_obj_pin() API
* Add support for libbpf bpf_object__next() API
* Rename BPF_{PROG,ATTACH}_TYPE_UNKNOWN to ...UNSPEC for libbpf compat
* Remove now-unused handle APIs ebpf_api_load_program and
  ebpf_api_pin_object, which is part of issue #383
  * netsh set/delete program now uses the ID to identify the program,
    like bpftool does, so that it can work even if the program wasn't
    loaded from an ELF file

Fixes #191

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-09-14 10:59:57 -07:00
Alan Jowett f5ba5c5d7c
Use CRT library to map handles to fds (#513)
* Use CRT library to map handles to fds

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-14 09:25:56 -06:00
Alan Jowett e553150b1b
Switch from MultiThreadedDebug to MultiThreadedDebugDll (#528)
* Switch from MultiThreadedDebug to MultiThreadedDebugDll
* Pull in latest ebpf-verifier

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-14 08:46:01 -06:00
Shankar Seal e84efdf092
Xdp adjust head part1 (#522)
xdp_adjust_head : Part 1
2021-09-13 17:46:23 -07:00
Shankar Seal 4d4c5b5cc7
refactor net_ebpf_ext (#520)
* refactor net_ebpf_ext
2021-09-13 14:46:43 -07:00
Alan Jowett f661e74d82
Fix unreliable test (#519)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-09-13 10:54:10 -06:00
Dave Thaler b6a0fb84b9
Add support for libbpf bpf_obj_get_info_by_fd API (#510)
* Add support for libbpf bpf_obj_get_info_by_fd API

This is the last libbpf api needed to enable the bpftool
flow to detach an already loaded program.

The count of maps is changed from size_t to uint32_t for
consistency with libbpf and because it's not actually a size
in the sizeof() sense, it's a count in the countof() sense.

Also fix bug where map_name was never being set in the kernel

Fixes #372

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-09-10 21:54:07 -07:00
Alan Jowett 25f9887e69
Remove dependency on run-tests.bat (#517)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-10 17:59:53 -06:00
Alan Jowett f0a07e7dd0
Switch to ExAllocatePoolZero (#509)
Resolves: #506

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-10 17:35:03 -06:00
Alan Jowett 7e12a6f920
Add support for bpf_ktime_get_ns (#511)
* Add support for bpf_ktime_get_ns

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-10 12:45:52 -06:00
Alan Jowett 84fef4e73c
Run utility helper tests in both interpret and jit modes (#512)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-10 10:39:30 -07:00
Shankar Seal acb6859758
Support for xdp_tx. (#498)
* xdp_tx

* Fix analysis error.

* update documentation.

* IPv6 tests.

* Apply suggestions from code review
2021-09-09 22:34:03 -07:00
Dave Thaler 38952de71a
Require all inner map attributes to match (#508)
Updated the map_in_map.c test to use HASH instead of ARRAY as the inner
map type, to make it possible to test key_size mismatch (since key_size
must be 4 for all ARRAY maps, it can't be tested with ARRAY).

Fixes #507

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-09-09 21:11:19 -07:00
Alan Jowett 4083f4eeb2
Add driver.yml - the workflow to install eBPF core on a self-host machine. (#504)
* Add driver.yml - the workflow to install eBPF core on a self-host machine and run tests.

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-09 18:01:52 -06:00
Dave Thaler c8d3ab9e73
Store ID in maps instead of fds and object pointers (#497)
Fixes #396

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-09-09 16:02:42 -07:00
Alan Jowett 24f5282063
Adding dependent workflow to run after build (#500) 2021-09-08 12:00:16 -06:00
Shankar Seal 8ee6344a1c
XDP ethernet packet (#493)
* cleanup test code.

* xdp eth packet.

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
Co-authored-by: Alan Jowett <alanjo@microsoft.com>
2021-09-07 14:07:17 -06:00
Alan Jowett 866f8a6917
Fix non-determinism in build due to multiple projects generating header (#496)
* Fix non-determinism in build due to multiple projects generating header
* Only regenerate git_commit_id.h on change

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-07 13:22:49 -06:00
Dave Thaler 7a921c0ef2
Add doxygen documentation for libbpf apis (#491)
* Add doxygen documentation for libbpf apis

Eventually this should be upstreamed, but as a workaround the docs
are put into our repo in the meantime.

As discussed at
https://stackoverflow.com/questions/23798053/how-to-document-errno-value-with-doxygen
doxygen does not have a built-in way to document errno values set.  It is
possible by creating doxygen custom commands, but for now we use
the "exception" section as recommended at the bottom of that page.

Fixes #490

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-09-07 10:51:18 -07:00
Dave Thaler 2349de2a46
Add object IDs (#487)
* Add object IDs

Add support for the following libbpf APIs:
* bpf_{link,map,prog}_get_fd_by_id
* bpf_{link,map,prog}_get_next_id

Addresses the main part of #396.
A subsequent PR will handle the rest of 396 which includes:
* remove "extra_value" complexity from maps

The changes in api_common.hpp and libbpf_internal.h are from PR 482 and so will go
away in a rebase once that PR is merged.

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>

* Address PR feedback

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-09-07 09:54:08 -07:00
Shankar Seal dae2a4def5
clean up test code (#492)
* cleanup test code.

* PR feedback.
2021-09-07 08:46:07 -07:00
dbarac 3e3e317ad4
add sample_ebpf_ext.sys to built_files array in scripts/deploy-ebpf.ps1 (#494) 2021-09-06 22:41:39 -07:00
Dave Thaler 5f5e2c0d1f
Add bpf_link_detach and bpf_link__fd APIs (#482)
* Add bpf_link_detach and bpf_link__fd APIs

Fixes #372

Addresses leftover TODO comments referencing issue 81.

Fixes bug where errno was not being set to correct errno values

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2021-09-03 14:51:50 -07:00
saxena-anurag cec8bd0014
Fix bpf_link__destroy(), add bpf_link__disconnect() (#485)
* api changes

* fix

* Apply suggestions from code review

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

* changes

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-09-03 12:21:04 -07:00
Alan Jowett f6d46d1b38
BPF_MAP_TYPE_PERCPU* should pad values to EBPF_CACHE_LINE_SIZE (#486)
* Cache align map structures

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-02 20:06:32 -07:00
Shankar Seal ec68058a36
Test utility helper functions. (#480)
* Test utility helper functions.

* fix build break.

* PR feedback.

* PR feedback.
2021-09-02 17:23:16 -07:00
Alan Jowett 74daa0fcec
Set ps unrestricted (#483)
* Set ExecutionPolicy Unrestricted for PS script in build

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-02 14:54:03 -06:00
Alan Jowett ffdc71166e
ebpf_epoch: _ebpf_flush_timer_set should be per-CPU (#481)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-02 13:55:45 -06:00
Alan Jowett ac9b6282b8
Add version info to ebpfcore.sys, ebpfapi.dll, netebpfext.sys, and ebpfsvc.exe (#478)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-09-01 17:57:35 -06:00
Dave Thaler dd3f1b427c
Rename ebpf_helpers.h to bpf_helpers.h for cross-plat compat (#472)
Libbpf has bpf_helpers.h which is mostly platform-agnostic, and
bpf_helper_defs.h which is platform-specific but is included
by bpf_helpers.h.   Until libbpf is made more platform-agnostic
(issue #351), the workaround is to have a separate pair of files.
Our bpf_helpers.h and our own bpf_helper_defs.h, both of which
would ideally be merged into libbpf's in the future.

Platform-specific defines are in ebpf_struct.h, though that
name may need to change later on.  Linux uses "linux/bpf.h"
(e.g., as used in the https://docs.cilium.io/en/v1.8/bpf/ and
https://developers.redhat.com/blog/2021/04/01/get-started-with-xdp
articles) or "vmlinux.h" (e.g., as used in the
https://ruderich.org/simon/notes/xdp-minimal-example article),
and these filenames are hard coded in eBPF programs.  In the future,
we should probably settle on a cross-platform name and use include
paths to distinguish them, as opposed to requiring ifdefs in eBPF
programs.  However, all of that is part of issue 351 and not this
issue.

Also removed obsolete/unused "repro.c" from tests/samples

Fixes #426

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

Co-authored-by: Alan Jowett <alanjo@microsoft.com>
2021-09-01 16:30:33 -07:00
Alan Jowett cab6f57fb6
Add performance benchmarks for helper functions. (#474)
* Add performance benchmarks for helper functions

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-09-01 13:43:59 -06:00
Dave Thaler e33680b562
Update verifier to latest (#473)
Fixes a display bug in "netsh ebpf show disassembly ..."
and "netsh show verification ... level=verbose"

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

Co-authored-by: Alan Jowett <alanjo@microsoft.com>
Co-authored-by: saxena-anurag <43585259+saxena-anurag@users.noreply.github.com>
2021-09-01 09:53:36 -06:00
Dave Thaler d5c275acb3
Add netsh command to show maps (#476)
Signed-off-by: Dave Thaler <dthaler@microsoft.com>

Co-authored-by: saxena-anurag <43585259+saxena-anurag@users.noreply.github.com>
2021-09-01 08:10:39 -07:00
Alan Jowett 2aaa711f7d
Revert untested changes to epbf_epoch.c (#475)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-08-31 21:19:31 -07:00
Alan Jowett 27c4c8f681
All per-CPU structures should be allocated on EBPF_CACHE_LINE_SIZE boundaries (#471)
* All per-CPU structures should be allocated on EBPF_CACHE_LINE_SIZE boundaries

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-08-31 18:21:00 -06:00
Alan Jowett ff47814b90
Workaround for issue where ProcDump64 swallows return codes. (#469)
* Set ProcDump64 as Just-In-Time debugger and set to capture dumps.
Fail test if dumps are generated.

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2021-08-31 14:21:22 -07:00
Alan Jowett 2e62286c9c
Simplified epoch tracking code to fix bugs hit in non-preemptive path. (#446)
* Fix epoch bugs and add performance tests
* Align ebpf_epoch_cpu_entry_t to CPU cache size to avoid false sharing

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2021-08-31 09:00:21 -06:00