Commit Graph

72 Commits (d9f966ec9e49f4439710559cac852bde62810975)

Author SHA1 Message Date
Tamir Duberstein d9f966ec9e
aya-log-common: support logging byte slices
These only support LowerHex and UpperHex hints for now.
Tamir Duberstein b1abac89c4
Remove reference to system-llvm
This feature is being phased out of bpf-linker.
dependabot[bot] 45072c0789 build(deps): update syn requirement from 1.0 to 2.0
Updates the requirements on [syn](https://github.com/dtolnay/syn) to permit the latest version.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.0...2.0.3)

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

Signed-off-by: dependabot[bot] <support@github.com>
Michal Rostecki 5fa17a192b integration-test: Add tests for aya-log
Michal Rostecki d31a1805da integration-test: Add `tokio_integration_test` macro
This new macro runs a test in a Tokio runtime and it can be used for
asynchronous tests (defined as `async fn`).
dependabot[bot] 4c78f7f1a0
build(deps): update object requirement from 0.30 to 0.31
Updates the requirements on [object](https://github.com/gimli-rs/object) to permit the latest version.
- [Release notes](https://github.com/gimli-rs/object/releases)
- [Changelog](https://github.com/gimli-rs/object/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gimli-rs/object/compare/0.30.0...0.31.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
Alessandro Decina 3a8380df26 integration-test: expand full path for IntegrationTest
Alessandro Decina 93ac3e94bc aya: support relocations across multiple text sections + fixes
Fix R_BPF_64_64 text relocations in sections other than .text (for
instance .text.unlikely). Also fix misc bugs triggered by integration
tests.
Alessandro Decina b2b9bd2edf integration tests: add relocation tests
Alessandro Decina bc8f4ef1c8 integration-tests: rename relocations to btf_relocations
In preparation of adding actual ELF relocation tests
Michal Rostecki ed9c2a1780 integration-tests: Build eBPF programs always with release profile
Also, add the `codegen-unit` option to the profile.
Tuetuopay 3655cd1e02 tests: use fedora 38 beta with testing repo
Now that bpf-linker uses llvm 16, the easiest way is to use Fedora 38
Beta with the testing repos as they have it, without resorting to
Rawhide.

See https://packages.fedoraproject.org/pkgs/llvm/llvm/.
Dave Tucker 376c486400 aya-bpf: Add multibuffer support for XDP
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
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 9a6f8143a1 aya: btf: add support for BTF_KIND_ENUM64
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 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
Alessandro Decina 405c6a8533
Merge pull request from MatteoNardi/remove_libbpf_dependency
Remove libbpf dependency from relocation tests
Michal Rostecki e2b3be6b31
Merge pull request from vadorovsky/integration-smoke-fix-version-check
integration-test: Fix the kernel version chceck for smoke test
Michal Rostecki 75336e5a35 integration-test: Fix the kernel version chceck for smoke test
Before this chane, the check was always negative if the minor version
was less then 9. So, for example, the smoke test was skipped for kernel
6.1:

```
skipping as 6.1 does not meet version requirement of 5.9
```

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
Matteo Nardi 3000949bcc Remove libbpf dependency from relocation tests
Simplifiy the relocation tests build process by removing the need for libbpf
at runtime. Its usage is replaced with local `__builtin_*` attributes.
This removes the need for the `LIBBPF_INCLUDE` env variable.
Michal Rostecki dad75f45ac Update Tokio and inventory
Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
Matteo Nardi 34e040b8e9 tests: use libtest-mimic and fix CI
Matteo Nardi 27f22f205d Make relocations tests actually pass
Matteo Nardi 702f77b565 tests: explain libbpf env variable
Matteo Nardi b72abcc7de tests: add pointer relocation test
Matteo Nardi 7e6a7d9005 btf: add integration tests for relocations
Add new integrations tests for BTF relocations.
Shenghui Ye 772af170ae aya-obj: add documentation on program names
This commit adds documentation on how program names are parsed from
section names, as is used by `aya_obj::Object.programs` as HashMap keys,
and updates the examples into using program names.
Shenghui Ye 311ead6760 aya-obj: add integration tests against rbpf
Alessandro Decina b3ae7786d3 aya: fix detaching links on drop
https://github.com/aya-rs/aya/pull/366 broke detaching links on drop for
everything but FdLink. This restores detach on drop for all links.
Alessandro Decina 9ce1530695 tests: skip tests that assume bpf_link based XDP on older kernels
Dmitry Savintsev 22340764a3 upgrade clap to 4.x
Michal Rostecki 1ded0e61cd
Merge pull request from aya-rs/dependabot/cargo/object-0.30
build(deps): update object requirement from 0.29 to 0.30
dependabot[bot] 1c8088b16c
build(deps): update env_logger requirement from 0.9 to 0.10
Updates the requirements on [env_logger](https://github.com/rust-cli/env_logger) to permit the latest version.
- [Release notes](https://github.com/rust-cli/env_logger/releases)
- [Changelog](https://github.com/rust-cli/env_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/rust-cli/env_logger/compare/v0.9.0...v0.10.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
dependabot[bot] 1fe7bba070
build(deps): update object requirement from 0.29 to 0.30
Updates the requirements on [object](https://github.com/gimli-rs/object) to permit the latest version.
- [Release notes](https://github.com/gimli-rs/object/releases)
- [Changelog](https://github.com/gimli-rs/object/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gimli-rs/object/compare/0.29.0...0.30.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
Alessandro Decina 832bdd280c {{crate_name}}: release version 0.1.13
Dmitry Savintsev 82773f46c8 Make the integration tests handle errors internally.
Instead of returning anyhow>>Result<()> handle errors
'in-place' with unwrap or panic, for more informative
and user-friendly error messages on test failures.

Fixes .

Signed-off-by: Dmitry Savintsev <dsavints@gmail.com>
Andrew Stoycos f3262e87bd Make map APIs return an option
switch map() and map_mut() from returning a
`Result` to an `Option` since it's just getting
a value from a Hashmap, and to stay in line with
the Programs API.

Remove `MapError::MapNotFound`

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
Andrew Stoycos 1aefa2e5e6 Core refactor of Map API
Build completing tests passing

Refactor the Map API to better align
with the aya programs API.  Specifically
remove all internal locking mechanisms
and custom Deref/DerefMut implementations.
They are replaced with a Map enum
and AsRef/AsMut implementations.

All Try_From implementations have been moved
to standardized enums, with a slightly
special one for PerfEventArray's.

Also cleanup/fix all associated tests and
documentation.

Signed-off-by: Andrew Stoycos <astoycos@redhat.com>
abhijeetbhagat c83d012c51 preserve existing behavior and avoid changes to gh workflows/xtask
abhi 4183c7a7d2
Merge branch 'aya-rs:main' into integration-tests-cli-options
abhijeetbhagat 7499661670 fix formatting
abhijeetbhagat 638cf514fb use macro to log, execute test and handle error
abhijeetbhagat 5b3e0ee856 add list, run cli flags to integration tests.
fixes: 
abhi 493a8db0ec
add libelf as a pre-requisite for linux, libbpf repo link
Michal Rostecki b15e1f8226 integration-test: Change `assert_loaded` to a macro with timeouts
We often need to wait a bit until the program or link gets unloaded
after dropping.

Also, using a macro makes it clear in which particular test the panic
happened.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>
Michal Rostecki 325391892c integration-test: Remove multimap C test
libbpf 1.0 doesn't support multimaps defined in `maps` section, it
supports only BTF maps.

At the same time, we already test multimaps loading with the Rust
example (`integration-ebpf/src/bpf/map_test.rs`), so we can just remove
the failing C test.

Signed-off-by: Michal Rostecki <vadorovsky@gmail.com>