Commit Graph

972 Commits (de4905a24bc0f665c40af964b56471c04434a8b4)
 

Author SHA1 Message Date
Dave Tucker de4905a24b aya: Add loaded_programs() API to list all loaded programs
This uses a Programs iterator to yield all loaded bpf programs using
bpf_prog_get_next_id.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
Dave Tucker 56c143831e
Merge pull request from dave-tucker/fix_perf_link
aya: Fix is_perf_link_supported
Dave Tucker ce79de7ff6 aya: Fix is_perf_link_supported
This was mistakenly comparing the exit code of the syscall, which is
always -1 and not the corresponding error-code. Added unit tests to
ensure we don't regress.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
Alessandro Decina d7d6442671
Merge pull request from dave-tucker/perf_link
Use bpf_link for perf_attach programs (Kprobe/Uprobe/Tracepoint etc...)
Dave Tucker 7479c1dd6c aya: More discrete feature logging
Just use the Debug formatter vs. printing a message for each probe.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
Dave Tucker d0b3d3b2fa aya: Enable bpf_link for perf_attach programs
This adds support for bpf_link to PerfEvent, Tracepoint, Kprobe and
Uprobe programs.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
Dave Tucker 763b92a2e0 aya: Add probe for bpf_link_create for perf programs
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
Dave Tucker ce22ca668f aya: Make features a lazy_static
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
Alessandro Decina bc83f208b1
Merge pull request from dave-tucker/frags
XDP Multi-Buffer Support
Dave Tucker 376c486400 aya-bpf: Add multibuffer support for XDP
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
vadorovsky bb1b39535c
Merge pull request from dmitris/derive-debug
aya-tool: remove outdated workaround
Dave Tucker a18693b42d aya: Add support for multibuffer programs
This adds support for loading XDP programs that are multi-buffer
capable, which is signalled using the xdp.frags section name. When this
is set, we should set the BPF_F_XDP_HAS_FRAGS flag when loading the
program into the kernel.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
Dmitry Savintsev 96b282d149 aya-tool: remove outdated workaround
The comment says that `.derive_debug` was needed as
a workaround for https://github.com/rust-lang/rust-bindgen/issues/2083.
This issue is now closed, and aya-tool compiles without derive_debug.

Additionally, update bindgen dependency to 1.64.

Signed-off-by: Dmitry Savintsev <dsavints@gmail.com>
Dave Tucker 811ab299de
Merge pull request from dave-tucker/program-from-pinned3
aya: Add from_pin for Programs
Dave Tucker 7a720ab0c1 aya: Add from_pin for Programs
This commit adds from_pin() which allows the creation of a Program
from a path on bpffs. This is useful to be able to call `attach` or
other APIs for programs that are already loaded to the kernel.

This differs from  since it implements this on the concrete program
type, not the Program enum, allowing the user to pass in any additional
context that isn't available from bpf_prog_info.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
Alessandro Decina cfa693bc3b
Merge pull request from alessandrod/fix-lru-hash
aya: fix Lru and LruPerCpu hash maps
Alessandro Decina c22014c757 aya: fix Lru and LruPerCpu hash maps
They were broken by https://github.com/aya-rs/aya/pull/397
Alessandro Decina 7868fffd7f
Merge pull request from astoycos/fix-badge
Fix Aya build badge
Andrew Stoycos 4ddbc1cacb
Fix Aya build badge
Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
Alessandro Decina 27017ca8a3
Merge pull request from astoycos/crucial-btf-fixes
Support BTF key/value specification for all maps
Andrew Stoycos 52e625060e
Support BTF key/value specification for all maps
Fix a bug which was resulting in `ENOTSUPP` following
the `BPF_MAP_CREATE` Syscall.  This fix was initially
found by libbpf maintainers in:
https://github.com/libbpf/libbpf/issues/355.

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
Alessandro Decina 22d79312f7
Merge pull request from anfredette/tc-link-recon
Support reconstruction of `SchedClassifierLink`
Andre Fredette 7855a0e0c6 retrigger checks
Signed-off-by: Andre Fredette <afredette@redhat.com>
Andre Fredette 7c24296b5d Address review comments from @alessandrod
Signed-off-by: Andre Fredette <afredette@redhat.com>
Michal Rostecki be5b4c82cc
Merge pull request from aya-rs/dependabot/cargo/indoc-2.0
build(deps): update indoc requirement from 1.0 to 2.0
dependabot[bot] 912ee06f39
build(deps): update indoc requirement from 1.0 to 2.0
Updates the requirements on [indoc](https://github.com/dtolnay/indoc) to permit the latest version.
- [Release notes](https://github.com/dtolnay/indoc/releases)
- [Commits](https://github.com/dtolnay/indoc/compare/1.0.0...2.0.0)

---
updated-dependencies:
- dependency-name: indoc
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Alessandro Decina e8e276730e
Merge pull request from alessandrod/btf-kind-enum64
Add support for BTF_KIND_ENUM64
Alessandro Decina 9a6f8143a1 aya: btf: add support for BTF_KIND_ENUM64
Alessandro Decina f81b1b9f3e
Merge pull request from alessandrod/fix-enum32-relocs
aya: btf: fix relocations for signed enums (32 bits)
Alessandro Decina 4482db42d8 aya: btf: fix relocations for signed enums (32 bits)
Enums now carry a signed bit in the info flags. Take it into account
when applying enum relocations.
Alessandro Decina d6b976c6f1 aya: btf: switch ComputedRelocationValue::value to u64
This is in preparation of adding Enum64 relocation support
Alessandro Decina 9d7c950d1b
Merge pull request from alessandrod/macos-tests
Speed up integration tests
Alessandro Decina 455cc95e8f integration-tests: run on macos to get nested virtualization
Switch integration-test host to macos as only macos runners support nested
virtualization. Adjust integration test runner accordingly.
Alessandro Decina 8e9608eedd test/run.sh: output `uname -a` after starting the vm
Alessandro Decina c7b262641b Run integration tests under fedora37
Michal Rostecki d2a999d27a
Merge pull request from vadorovsky/unpin-nightly
Unpin Rust nightly
Michal Rostecki 7d19bde66b Unpin Rust nightly
The issues with core::sync::atomic got fixed.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
Alessandro Decina 3e9d85f871
Merge pull request from vadorovsky/bpf-macros-visibility
aya-bpf-macros: Allow to make programs public
Alessandro Decina 7e5637bb9c
Merge pull request from banditopazzo/tracefs_mount_select
add tracefs mount point select function
banditopazzo 48fdf5a250 chore: tracefs review fixes
banditopazzo c6c4ac7eea feat: get_tracefs function
Michal Rostecki 6ad2c3c373 aya-bpf-macros: Allow to make programs public
Allow to define programs as public functions (even in library crates)
and then import them.

For example, we can have library crate with `libfoo/src/lib.rs`
containing:

```rust
pub fn my_xdp_program(ctx: XdpContext) -> u32 {
    xdp_action::XDP_PASS
}
```

And then a binary importing it:

```rust
pub use libfoo::my_xdp_program;
```

This way, commonly used eBPF programs can be distributed as lib crates.

Tested with: https://github.com/vadorovsky/aya-examples/tree/main/pub-progs

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
Alessandro Decina 556463a85f ebpf: SkbBuff: add some accessors
Andre Fredette d43879d991 Updates after rebase due to changes in define_link_wrapper
Signed-off-by: Andre Fredette <afredette@redhat.com>
Andre Fredette 6766532341 Remove SchedClassifierLink description
It was redundant with the one provided in define_link_wrapper

Signed-off-by: Andre Fredette <afredette@redhat.com>
Andre Fredette 2972d462a5 Address review comments
- Rename `new_tc_link` to `attached`
- Simplified example for `attached`

The following was not requested in reviews:
- Moved example from `SchedClassifierLink` tor
  `SchedClassifierLink::attached' since we're only showing an
  example of that one method

Signed-off-by: Andre Fredette <afredette@redhat.com>
Andre Fredette 65f5b76593 Address review comments
Signed-off-by: Andre Fredette <afredette@redhat.com>
Andre Fredette 849796c420 rename SchedClassifierLink:new() to new_tc_link()
Avoids name confilct with pr 

Signed-off-by: Andre Fredette <afredette@redhat.com>
Andre Fredette 67efc33414 Additional edits to SchedClassifierLink documentation.
Signed-off-by: Andre Fredette <afredette@redhat.com>
Andre Fredette 6563e6cc06 Combine updates to SchedClassifierLink example made by Dave Tucker
Co-authored-by: Dave Tucker <dave@dtucker.co.uk>
Signed-off-by: Andre Fredette <afredette@redhat.com>