Commit Graph

300 Commits (8e9404ecd4c229cccc13e691b2b59dc4c6ccc4ba)

Author SHA1 Message Date
Tamir Duberstein b2fd9493a8
integration-test: handle !bpf_perf_link 5 days ago
Tamir Duberstein 0ec60c4f23
Skip `bpf_strncmp` on kernel < 5.17 5 days ago
Tamir Duberstein 4c22a99cb0
Skip af_xdp when AF_XDP is unsupported 5 days ago
Tamir Duberstein e5306901a0
Skip `test_uprobe_cookie` on kernel < 5.15 6 days ago
Tamir Duberstein 08cf90881f
integration-test: extract run_pin_program_lifecycle_test 6 days ago
Tamir Duberstein fe43f776c3
integration-test: extract from_pin 6 days ago
Tamir Duberstein 0840faf6b1
integration-test: extract pin paths 6 days ago
Tamir Duberstein 0f1c975632
integration-test: extract run_unload_program_test 6 days ago
Tamir Duberstein a6458804fc
integration-test: extract types 6 days ago
Tamir Duberstein a2f4951cce
integration-test: remove errant semicolons 6 days ago
Tamir Duberstein 89d746ad1b
integration-test: extract attach fns 6 days ago
Tamir Duberstein 48300b6498
integration-test: extract program names 6 days ago
Tamir Duberstein 4041fe9293
integration-test: move memmove out of pin tests 6 days ago
Christian A. Jacobsen a98b638fa9 feat(log): add support for logging raw pointer types
* Requires the usage of `:p` display hint.
* Will, like stdlib, log with `0x` prefix.
6 days ago
Altug Bozkurt fc5387c806
lsm: cgroup attachment type support 2 weeks ago
Tamir Duberstein 66ed37c8a9
integration-test: add LSM 2 weeks ago
Tamir Duberstein 8e75214815
feature_probe: properly check for LSM support
Turns out this is not supported in aarch64 until 6.4.
2 weeks ago
Tamir Duberstein 9ba87c661b
xtask: copy kernel config into the initramfs image
When preparing the VM initramfs detect the `config-*` file that ships alongside
the vmlinuz/modules in each kernel archive and install it under `/boot` (both
as `/boot/config` and `/boot/config-<version>`). This makes the running
kernel’s configuration available inside the guest for the integration tests.
2 weeks ago
Tamir Duberstein ffa65efb36
integration-ebpf: avoid mentioning the size 2 weeks ago
Michal R 98e8c78376 aya-ebpf: Make use of `Borrow` and `BorrowMut` in map methods
Let callers pass either owned objects or references. We do that already
in the user-space methods.
2 weeks ago
Tamir Duberstein de42b80c74
aya,ebpf: add BPF_MAP_TYPE_SK_STORAGE
This map type requires BTF, and we can finally do it!
2 weeks ago
Tamir Duberstein c9b5f119a3
feature_probe: clarify composite logic 2 weeks ago
Tamir Duberstein 75edc3d294
*: downcase log strings 2 weeks ago
Tamir Duberstein 5f5305c2a8
lint all crates; enable strict pointer lints 3 weeks ago
Tamir Duberstein 82e72a14ad
Remove unused import
```
  error: unused import: `define_linear_ds_test`
    --> test/integration-ebpf/src/linear_data_structures.rs:59:5
     |
  59 | use define_linear_ds_test;
     |     ^^^^^^^^^^^^^^^^^^^^^
     |
     = note: `-D unused-imports` implied by `-D warnings`
     = help: to override `-D warnings` add `#[allow(unused_imports)]`

  error: could not compile `integration-ebpf` (bin "linear_data_structures") due to 1 previous error
```
3 weeks ago
Michal R 0b2a544ddd aya-ebpf: Add BTF array definition
Before this change, Aya supported only legacy BPF map definitions, which
are instances of the `bpf_map_def` struct and end up in the `maps` ELF
section.

This change introduces a BTF map definition for arrays, with custom
structs indicating the metadata of the map, which end up in the `.maps`
section.

Co-authored-by: Tamir Duberstein <tamird@gmail.com>
1 month ago
Adam Schreck 263e864cd9 aya: add Map::from_map_data() for pinned map access
Enables creation of Map enum variants directly from MapData instances,
allowing user-space handles to pinned BPF maps without requiring the
original BPF object.

Supports multiple BPF map types.

Motivation:
- Simplifies accessing pinned maps from user space applications.
- Avoids full BPF reloads and potential deadlocks.
- Matches existing ergonomic APIs like LruHashMap::try_from.
- Keeps user code safe and idiomatic.

Closes https://github.com/aya-rs/aya/issues/1305.

Includes test coverage to validate the new API.
1 month ago
Tamir Duberstein 353b83383d
aya-log-ebpf: zero copy! 1 month ago
Tamir Duberstein 8e2632921f
aya-log: add DST test 1 month ago
Tamir Duberstein aa47acc507
aya-log-ebpf: allow macros in expr position
This is load-bearing in aya-template.
2 months ago
Xiaobo Liu 53ec616411 ebpf: add peak() method to Queue and Stack
Add integration tests covering push,pop,peek for both types.

Signed-off-by: Xiaobo Liu <cppcoffee@gmail.com>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
2 months ago
Addison Crump f6606473af
aya-log: properly hint log level to verifier
The log level implementation in b36cbc3eb8
was incomplete as the verifier could reject programs which exceeded
their instruction limits within logging statements. This commit
addresses this issue by making the log level static variable immutable
(s.t. the compiler puts it in a read-only section) and adds an
additional test which the verifier will reject as an infinite loop iff
it is unable to detect that the static variable would otherwise allow
the logging.
2 months ago
Tamir Duberstein b36cbc3eb8
implement load-time log level mask 2 months ago
Tamir Duberstein a3aa387a2e
remove superfluous commas 2 months ago
Tamir Duberstein 0b1fbe1cd3
integration-test: add missing `test_log` decorator
Use the fully qualified macro name which composes better with
`test_case` and makes it easier to spot cases where it is missing.
4 months ago
Tamir Duberstein 61376c4608
aya-log: Remove tokio dep
Require the caller to provide their own executor.
4 months ago
Tamir Duberstein 44b26b3b50 integration-test: use only readable interest 4 months ago
Tamir Duberstein 5fa52ac5c1 integration-test: remove an allocation 4 months ago
dependabot[bot] f96250e80d
build(deps): bump the cargo-crates group with 2 updates
Updates the requirements on [bindgen](https://github.com/rust-lang/rust-bindgen) and [which](https://github.com/harryfei/which-rs) to permit the latest version.

Updates `bindgen` to 0.71.1
- [Release notes](https://github.com/rust-lang/rust-bindgen/releases)
- [Changelog](https://github.com/rust-lang/rust-bindgen/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/rust-bindgen/compare/v0.71.0...v0.71.1)

Updates `which` to 7.0.3
- [Release notes](https://github.com/harryfei/which-rs/releases)
- [Changelog](https://github.com/harryfei/which-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/harryfei/which-rs/compare/7.0.0...7.0.3)

---
updated-dependencies:
- dependency-name: bindgen
  dependency-version: 0.71.1
  dependency-type: direct:production
  dependency-group: cargo-crates
- dependency-name: which
  dependency-version: 7.0.3
  dependency-type: direct:production
  dependency-group: cargo-crates
...

Signed-off-by: dependabot[bot] <support@github.com>
4 months ago
dependabot[bot] a7e3e6d4d9
build(deps): bump the cargo-crates group with 2 updates
Updates the requirements on [cargo_metadata](https://github.com/oli-obk/cargo_metadata) and [object](https://github.com/gimli-rs/object) to permit the latest version.

Updates `cargo_metadata` to 0.19.2
- [Release notes](https://github.com/oli-obk/cargo_metadata/releases)
- [Changelog](https://github.com/oli-obk/cargo_metadata/blob/main/CHANGELOG.md)
- [Commits](https://github.com/oli-obk/cargo_metadata/compare/0.19.0...0.19.2)

Updates `object` to 0.36.7
- [Changelog](https://github.com/gimli-rs/object/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gimli-rs/object/compare/0.36.0...0.36.7)

---
updated-dependencies:
- dependency-name: cargo_metadata
  dependency-version: 0.19.2
  dependency-type: direct:production
  dependency-group: cargo-crates
- dependency-name: object
  dependency-version: 0.36.7
  dependency-type: direct:production
  dependency-group: cargo-crates
...

Signed-off-by: dependabot[bot] <support@github.com>
5 months ago
Tamir Duberstein 630a767117 Split relocation tests into multiple files
This avoids requiring kernel support for all types of relocations when
testing a specific type.
5 months ago
Tamir Duberstein c8e9037ca6 Avoid uncontrolled stdout into cargo
This fixes rebuild on change of C sources by black-holing:
- Output of `make` (harmless).
- Output of `llmv-objcopy` (harmful: binary data).
5 months ago
Tamir Duberstein 025b6eaa0d Use a macro to reduce boilerplate 5 months ago
Tyrone Wu 23bc5b5836 aya,aya-obj: cache feat probed info fields
Cached probed for ProgramInfo fields instead of exposing it through
global FEATURE. Probing occurs on cache miss, which happens when first
accessing the field, *and* if the field is 0.
5 months ago
Tyrone Wu bd492860f5 aya: add feature probing for map type
Add API that probes whether kernel supports a map type.
5 months ago
Tyrone Wu ab77decd9a aya,aya-obj: add feature probing program type
Adds API that probes whether kernel supports a program type.
5 months ago
Dave Tucker 7dba5a41ad feat(aya): Make LinkInfo and loaded_links public
We have had loaded_links in the API as `#[doc(hidden)]` for a while.
I've been using it in bpfman and it's been fine. This commit does the
minimal work required to make the API stable.

We expose a `LinkInfo` type - similar to `ProgInfo` - which wraps the
generated type. In this case, `bpf_link_info`.

A few accessor functions have been added for `id`, `link_type` and
`program_id`. There are many more fields that could be (eventually)
made public.

As a convenience, `LinkInfo` can be retrieved from an existing FdLink
by using `FdLink::info()`.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
6 months ago
Tamir Duberstein 583709f6a0 appease `clippy::uninlined-format-args` 6 months ago
dependabot[bot] c0ff1aa0cc
build(deps): update network-types requirement in the cargo-crates group
Updates the requirements on [network-types](https://github.com/vadorovsky/network-types) to permit the latest version.

Updates `network-types` to 0.0.7
- [Release notes](https://github.com/vadorovsky/network-types/releases)
- [Changelog](https://github.com/vadorovsky/network-types/blob/main/CHANGELOG.md)
- [Commits](https://github.com/vadorovsky/network-types/compare/v0.0.7...v0.0.7)

---
updated-dependencies:
- dependency-name: network-types
  dependency-version: 0.0.7
  dependency-type: direct:production
  dependency-group: cargo-crates
...

Signed-off-by: dependabot[bot] <support@github.com>
6 months ago
Michal Rostecki e229231d88 xtask: Move libbpf header installation logic to a helper function
Before that, the same code was repeated twice in different places.
7 months ago