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

416 Коммитов

Автор SHA1 Сообщение Дата
Anurag Saxena e98358ad16
Add batch invocation test for sample_ebpf_ext (#2593)
* backup

* fix

* cleanup

* fix
2023-06-24 04:37:59 +00:00
Alan Jowett 62537b4f15
Timeout during fault injection (#2621)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2023-06-22 17:17:14 +00:00
Alan Jowett c1fecf4e2d
Implement hash-table iterator (#2566)
* Implement hash-table iterator

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>

* Switch iterator to match BPF_MAP_LOOKUP_BATCH syscall behavior

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

* Switch iterator to match BPF_MAP_LOOKUP_BATCH syscall behavior

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

---------

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2023-06-22 16:43:44 +00:00
Alan Jowett 1955692077
Add option to write bpf2c output directly to file (#2570)
* Add option to write bpf2c output directly to file

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

* PR feedback

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

---------

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2023-06-22 03:23:07 +00:00
Anurag Saxena b5d0dfa141
Fix build failures with latest MSVC (main) (#2598)
* test

* fix MSVC path

* Revert "test"

This reverts commit c0c42dd2bd.

* update hash

* use env variable for MSVC path

* export env variable

* fix analysis failures
2023-06-15 20:09:37 +00:00
Alan Jowett 9edb6a3da8
Add support for map info via BTF in .maps section (#2551)
* Switch bpf2c to use BTF .maps section

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>

---------

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2023-06-08 05:26:05 +00:00
Dhiren Vispute 10735e577c
Fix double-load issue (#2552)
Co-authored-by: Dhiren Vispute <dhiren.vispute@microsoft.com>
2023-06-07 17:02:43 +00:00
Dhiren Vispute 595e96150d
Fix cgroup/connect<4|6> usage (#2546)
Co-authored-by: Dhiren Vispute <dhiren.vispute@microsoft.com>
2023-06-07 15:58:06 +00:00
Dave Thaler 87b6520c34
Remove JIT and interpreter code from NativeOnly builds (#2475)
* Remove JIT and interpreter code from NativeOnly builds

Fixes #2030
Fixes #2488

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

* Try conditional project references

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

* Various test fixes

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

* Native-only fixes to deploy-ebpf.ps1

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

* Native-only support for setup-ebpf.ps1

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

* Native-only support for api_test.exe

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

* Add connect_redirect_tests to deploy-ebpf.ps1

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

* PR feedback from Anurag

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

---------

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2023-06-07 15:49:03 +00:00
Sharmi 8adab0de10
stress test for tail calls (#2518)
* Add stress test for tail calls

* Added the code generated bindmonitor_mt_tailcall files

* Added the test case description to readme.md

* Update tests/stress/km/stress_tests_km.cpp

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

* Update tests/stress/km/stress_tests_km.cpp

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

* Addressed PR comments and Fixed merge conflicts with latest

* Fixed function name

* Regenerated the expected files, after the macro MAX TAIL CNT change done yesterday

* Update tests/stress/readme.md

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

* Removed clean_up tail call

* Add bind in loop

* updated the readme

* Addressed PR comments

* Changed LOG_VERBOSE to LOG_ERROR

* Updated readme and addressed PR comment

---------

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2023-06-07 05:21:47 +00:00
Gianni Trevisiol d6bcf1958c
Refactor eBPFCore tracing to use less stack space. (#2501)
* refactor ebpfcore tracing

* feedback
2023-05-31 17:26:09 +00:00
Dhiren Vispute b054f0fb32
tweak extension stop/restart, better handling of test runtime (#2519)
Co-authored-by: Dhiren Vispute <dhiren.vispute@microsoft.com>
2023-05-26 02:59:13 +00:00
Anurag Saxena c471719074
Fix closing native program / maps handles in system worker thread. (#2500)
* fix

* fix analyze build

* fix memory leak

* add tests

* code reorder

* mark new tests for DEBUG only

* fix Release build

* CR comments

* cr comments
2023-05-26 02:19:41 +00:00
Alan Jowett 904608de4e
Don't throw exceptions from ~_single_instance_hook (#2514)
* Don't throw exceptions from ~_single_instance_hook

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

* Fix AV

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

---------

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2023-05-25 18:42:03 +00:00
Alan Jowett 396412bc56
Add recursive tail call test (#2504)
* Add recursive tail call test

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

* Add sequential tail call test

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 code analysis failure

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

* Document workaround for bpf_helpers.h conflict

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

---------

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2023-05-24 20:01:01 +00:00
Alan Jowett f084c9d4c3
Remove unneeded nuget package (#2507)
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2023-05-24 14:38:32 +00:00
Dhiren Vispute 92a2728021
Ensure valid shift values for *SH* instructions (#2470)
Co-authored-by: Dhiren Vispute <dhiren.vispute@microsoft.com>
2023-05-18 19:18:21 +00:00
Dave Thaler 05be0228db
Fix build errors with Visual Studio 17.6.0 (#2483)
* Fix build errors with Visual Studio 17.6.0

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

* PR feedback

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

---------

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2023-05-17 23:02:46 +00:00
Gianni Trevisiol 5950a9785b
Load/Attach/Unload programs only once for connect_redirect tests. (#2450)
* draft

* comments, rename

* nit

* test

* nit

* test

* test

* aggregate globals

* Fix C26495 warnings

* debug

* test

* debug

* debug instrument

* instrument

* comment

* debug

* fix hints and address_info leak

* fix leak

* wip

* fix

* fix

* tests

* Finalize and remove instrumentation.

* Merge bpf_object_ptr definitions

* feedback

* nit

* fixed SAL annotation

* feedback

* nit

* revert
2023-05-17 17:32:04 +00:00
Dave Thaler 67ef157802
Revert bpf_printk thunk (#2472)
Fixes #1715

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2023-05-16 16:07:05 +00:00
Dhiren Vispute 574d41b49c
Code clean-up, duplicate code refactoring (#2467)
Co-authored-by: Dhiren Vispute <dhiren.vispute@microsoft.com>
2023-05-16 02:29:28 +00:00
Anurag Saxena 5ad65e59e2
Add basic regression test for 0.9.0 (#2444)
* add regression test

* fix
2023-05-15 20:36:44 +00:00
Alan Jowett 6d31ca1261
Remove NMR extension wrapper code. (#2434)
* Remove NMR extension wrapper code.

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 code analysis and cmake failures

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

* Don't call NMR apis are dispatch

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

* Fix code analysis failure

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

---------

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2023-05-15 18:49:55 +00:00
Sharmi 144b28f0cd
Add test for SeAccessCheckFromState Kernel OS user-mode API (#2464)
* Test SeAccessCheckFromState Kernel OS usermode API

* Removed contents in ebpf_nethooks.h

* Addressed PR comments
2023-05-15 05:00:22 +00:00
dependabot[bot] 850806706c
Bump external/ubpf from `2071abb` to `8e1a158` (#2461)
* Bump external/ubpf from `2071abb` to `8e1a158`

Bumps [external/ubpf](https://github.com/iovisor/ubpf) from `2071abb` to `8e1a158`.
- [Commits](2071abbed9...8e1a1585b1)

---
updated-dependencies:
- dependency-name: external/ubpf
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Remove duplicated code

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

* Fix cmake build

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

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Alan Jowett <alanjo@microsoft.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alan Jowett <alanjo@microsoft.com>
2023-05-11 18:20:46 +00:00
Alan Jowett f92c9995b0
Add object history tracking instrumentation (#2449)
* Add object history tracking instrumentation

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

* Fix file_id type in history

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

* Code analysis failure

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

* PR feedback

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

* Fix incorrect instrumentation

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

---------

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2023-05-11 02:50:50 +00:00
Gianni Trevisiol 4f41426bf1
Release v0.9.0 (#2425)
* Release 0.9.0

* nit newline
2023-05-03 03:17:59 +00:00
Anurag Saxena c2f7735a15
Wait for preemptible work items to complete in UM mock. (#2420)
* backup

* fix

* code cleanup

* move code under try-catch

* fix

* fix leak

* fix
2023-05-03 00:07:57 +00:00
Anurag Saxena c52f3dbe89
Add kernel tests for native_only build. (#2407)
* fix api_tests

* fix native and socket kernel tests

* fix bpftool_tests

* fix cmake build

* fix sample ext app

* fix tests

* add new cicd test

* fix analyze build

* change to using guids

* code cleanup

* code cleanup

* fix bad merge

* revert cicd job name

* cr comments
2023-05-02 18:32:16 +00:00
Anurag Saxena 93eb42a908
Revert "socket tests and redirection tests does not clean up bpf_object on failure (#2226)" (#2419)
This reverts commit 6c025904b3.
2023-05-02 04:01:52 +00:00
Dhiren Vispute c0e0804456
Ensure non-zero helper function count before using it in allocation computations. (#2393) 2023-05-02 00:50:34 +00:00
Alan Jowett 332fa2ba1e
Provide option to version info in generated .sys file (#2401)
* Provide option to version info in generated .sys file

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

* PR feedback

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

---------

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2023-05-02 00:39:42 +00:00
Dave Thaler 543403af77
Add netsh command to enumerate processes using eBPF (#2379)
* Add netsh command to enumerate processes using eBPF

Addresses part of issue #555

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

* Fix build/test issues

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

* Fix potential buffer overrun

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

* Fix output when running non-elevated

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

* Exclude [processes] test from CodeCoverage

OpenCodeCoverage uses STATUS_BREAKPOINT and doesn't work reliably
with code that uses TerminateThread().  For now we exclude this
test from code coverage runs.

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

---------

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2023-05-01 20:01:50 +00:00
Delaram Amiri 6c025904b3
socket tests and redirection tests does not clean up bpf_object on failure (#2226)
* wrapper for tests using smart pointer

* address PR comments

* address PR comments

* update connect edirect test

* update connect redirect test

* resolve conflict

* resolve conflict

* test with connect redirect

* test with connect redirect

* change connect redirect test

* address PR comment

* rebase the changes from main

* rebase the changes from main

* Update tests/connect_redirect/connect_redirect_tests.cpp

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

* address PR comment

* modify the bpf object pointer

---------

Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2023-04-28 18:27:04 +00:00
Alan Jowett 8b1a8e4e0f
Update NuGet packages (#2386)
Co-authored-by: Alan-Jowett <Alan-Jowett@users.noreply.github.com>
2023-04-28 15:57:08 +00:00
Dhiren Vispute 83567d6270
Add Multi-threaded stress tests (kernel mode). (#2240) 2023-04-25 21:00:44 +00:00
Sharmi 03c6297621
Simulate NMR API failure (#2263)
* Initial commit to get AddressSanitizer build

* Fix heap-use-after-free

* merge main contents

* Added client registration initialization and double heap free after use

* Fix build error

* Checked for bindcontext

* Only fail NMR registration

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

---------

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
Co-authored-by: Alan Jowett <alanjo@microsoft.com>
2023-04-21 18:50:41 +00:00
Alan Jowett 101d177ff5
Merge create and initialize to limit data races (#2347)
* Merge create and initialize

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

* PR feedback and merge of previous commit

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

---------

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2023-04-21 18:06:48 +00:00
Sharmi e6f96cc3e1
Remove eBPF for Windows hard-coded dependency on SHA256 (#2252)
* Initial commit

* Initial commit

* Initial commit-2

* Implement correct utf8 to unicode handling

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

* Removed changes in ebpf_api files to addres PR comment

* Added test case

* Update libs/platform/ebpf_platform.h

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

* Update libs/platform/ebpf_platform.h

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

* Update tools/bpf2c/bpf_code_generator.cpp

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

* Addressed PR comments

---------

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
Co-authored-by: Alan Jowett <alanjo@microsoft.com>
Co-authored-by: Dave Thaler <dthaler@microsoft.com>
2023-04-20 17:51:40 +00:00
Dave Thaler 62c0d9e111
Add compartment support to netsh ebpf add program (#2321)
* Add compartment support to netsh ebpf add program

Fixes #2185

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

* Address PR feedback

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

---------

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2023-04-20 03:32:28 +00:00
Michael Friesen 664a6125ac
Fix ebpf_program_batch_end_invoke_function_t definition and clean up NPI (#2329) 2023-04-17 20:23:20 +00:00
Alan Jowett 9a4853adee
Check for crash dumps on workflow faiure (#2327)
* Check for crash dumps on workflow failure.
Fastfail the process on watchdog timeout.

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

* Remove intrin.h to prevent conflict with Windows SDK.

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

* Suppress failfast during unit testing

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

---------

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2023-04-14 17:49:47 +00:00
Gianni Trevisiol 3b86a71ca0
Handle map concurrency in `test_helper`. (#2319)
* Handle concurrency in maps.

* nit lock scoping

* Handle concurrency in maps.

* nit lock scoping

* sync

* sync

* nit comment
2023-04-14 16:47:53 +00:00
Alan Jowett 8c58620bdf
1. Optimize netebpfext_unit tests to avoid running (#2322)
tests that pass again.
2. Update Test-FaultInjection.ps1 to log what tests
are run in each iteration.
3. Avoid decoding symbols under a lock.

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2023-04-14 03:01:09 +00:00
Dave Thaler 93b7634d23
Fix sanitizer build of fuzzer (#2201)
* Fix sanitizer build of fuzzer

Fixes #1817

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

* Fixes

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

* More fixes

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

* Disable some build steps for FuzzerDebug

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

* Update github workflows

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

* Update verifier to latest

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

* Fix execution_context_fuzzer build

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

* Fix bpf2c and samples

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

* Fix samples compilation

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

* Fix custom program type sample

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

---------

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2023-04-13 15:00:49 +00:00
Dave Thaler 35f909deb9
Allow various structs to be const (#2306)
Fixes #2145

Signed-off-by: Dave Thaler <dthaler@microsoft.com>
2023-04-12 17:47:39 +00:00
Anurag Saxena d8ccbc7625
connect_redirect tests: Add check that source port is not 0 (#2289)
* fix

* update expected files
2023-04-10 20:47:41 +00:00
Alan Jowett e8f437f364
Raise STATUS_ASSERTION_FAILURE on test timeout (#2272)
* Raise STATUS_ASSERTION_FAILURE on test timeout

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

* PR feedback

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

* Manually generated dump on test timeout

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

---------

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2023-04-06 23:03:43 +00:00
Anurag Saxena dcc2e6470c
Fix memory leaks (#2267)
* cicd.yml change -- revert

* fix leak

* fix leaks

* fix leak

* Revert "cicd.yml change -- revert"

This reverts commit 0ff2cff79b.

* code cleanup

* CR comments
2023-04-04 20:06:30 +00:00
Alan Jowett de29fbb951
Remove hard affinity in epoch code (#2262)
* Remove hard affinity in epoch code

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

* Code analysis failure

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

* Remove APC related logic

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

---------

Signed-off-by: Alan Jowett <alanjo@microsoft.com>
2023-04-04 02:52:21 +00:00