Commit Graph

1342 Commits (b54a106584bf636cbd0ad217aa62124348e6b29f)
 

Author SHA1 Message Date
Tamir Duberstein a0af7e0b2f
programs: make `loaded_programs` opaque 1 year ago
Tamir Duberstein de8519a380
sys: extract common SyscallError
We currently have 4 copies of this.
1 year ago
Tamir Duberstein 4cb3ea6e8f
sys: `sys_bpf` takes mut ref
Some syscalls mutate the argument, we can't be passing an immutable
reference here.
1 year ago
Tamir Duberstein f095c591af
Merge pull request #714 from aya-rs/dry-btf-load
sys: avoid repeating BPF_BTF_LOAD dance
1 year ago
Tamir Duberstein 7ee6f52a74
sys: avoid repeating BPF_BTF_LOAD dance 1 year ago
Tamir Duberstein 3692e53ff0
Merge pull request #706 from aya-rs/reloc-tests
integration-test: Remove runtime toolchain deps
1 year ago
Tamir Duberstein dca5e6c167
integration-test: Remove runtime toolchain deps
Move the use of clang and llvm-objcopy from run-time to build-time. This
allows the integration tests to run on VMs with simpler userlands.

Create a new CI job to build the integration tests separately from
running them. Ship them from that job to the runner job using github
actions artifacts.
1 year ago
Tamir Duberstein 5a398504cf
test: appease shellcheck 1 year ago
Tamir Duberstein 571c38b1c6
test: add some #[track_caller] annotations 1 year ago
Tamir Duberstein 6f3cce75cf
test: s/assert!(.*) ==/assert_eq!\1,/
One case manually adjusted to `assert_matches!`.
1 year ago
ajwerner afacfddd8b
Merge pull request #710 from ajwerner/move-rustversion-to-workspace
bpf: move rustversion build dep to workspace
1 year ago
Andrew Werner 9f0e83726f bpf: move rustversion build dep to workspace
All the other dependencies are at the workspace level other than this
one.
1 year ago
Tamir Duberstein 4c3219f754
Merge pull request #707 from aya-rs/one-option-not-two
Reduce state cardinality from 4 to 2
1 year ago
Tamir Duberstein 0ec9afdb07
Reduce state cardinality from 4 to 2
Encode into the type system the fact that PerfLink::probe_kind and
PerfLink::event_alias are present or absent together.
1 year ago
Tamir Duberstein 445cb8b463
Merge pull request #701 from nrxus/perf-event-owned-fd
aya: Return `OwnedFd` for `perf_event_open`.
1 year ago
Andrés Medina dbfba18dac aya: Return `OwnedFd` for `perf_event_open`.
This fixes a file descriptor leak when creating a link of
BPF_PERF_EVENT attach type.
1 year ago
Dave Tucker e833a71b02
Merge pull request #413 from dave-tucker/fix-names-once-and-for-all
aya: fix names once and for all
1 year ago
Tamir Duberstein 868a9b00b3
Merge pull request #704 from aya-rs/better-panic
all: better panic messages
1 year ago
Dave Tucker 6d92119fbc integration-test: Add test for 2 progs in same section
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
1 year ago
Dave Tucker c72aab5f7b aya-bpf-macros: Refactor for ease of testing
The aya-bpf-macros needed refactoring for:

1. Ease of testing
2. To be consistent with when we use K/V args vs. idents
3. To deprecate the use of `name` to change the exported name of a
   function - we now use the symbol table.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
1 year ago
Dave Tucker bf7fdff1ce aya: Find programs using the symbol table
This makes a few changes to the way that Aya reads the ELF object
files.

1. To find programs in a section, we use the symbols table. This allows
   for cases where multiple programs could appear in the same section.
2. When parsing our ELF file we build symbols_by_section_index as an
   optimization as we use it for legacy maps, BTF maps and now programs.

As a result of theses changes the "NAME" used in `bpf.prog_mut("NAME")`
is now ALWAYS the same as the function name in the eBPF code, making the
user experience more consistent.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
1 year ago
Tamir Duberstein 17f25a6793
all: better panic messages
Always include operands in failing assertions. Use assert_matches over
manual match + panic.
1 year ago
Tamir Duberstein f705eabe66
Merge pull request #696 from Tuetuopay/tests-netns
test: add the possibility to run a test inside a network namespace
1 year ago
Dave Tucker 8778c4ca29
Merge pull request #695 from aya-rs/mergify/dave-tucker/config-update
ci(Mergify): configuration update
1 year ago
Dave Tucker 34d1d7a9d7 ci(Mergify): configuration update
This does 3 things:

- Automatically merges Dependabot PRs that pass CI
- Labels all PRs 🙏 which was previously done manually for the release note generation
- Assigns Alessandro to review any PR for which xtask/public-api/aya.txt has changed

Signed-off-by: Dave Tucker <datucker@redhat.com>
1 year ago
Tuetuopay c74813f8c5 test: add the possibility to run a test inside a network namespace
For tests that do networking operations, this allows to have a
clean-state network namespace and interfaces for each test. Mainly, this
avoids "device or resource busy" errors when reusing the loopback
interface across tests.
1 year ago
Tamir Duberstein e95f76a5b3
Merge pull request #699 from aya-rs/cache-again-god-damn-it
Misc testing improvements
1 year ago
Tamir Duberstein 8961be9526
Do not escape newlines on Err(LoadError).unwrap()
Wrap verifier logs in a newtype whose `Debug` impl emits unescaped
newlines. This improves ergonomics in tests where we `Result::unwrap()`
those load errors; when these fail today they emit the errors with
newlines escaped, making them incredibly difficult to read.
1 year ago
Tamir Duberstein 49cbb1366f
integration-test: rerun-if-changed=integration-ebpf
See code commentary for details.
1 year ago
Tamir Duberstein 13e83b24ee
Merge pull request #662 from nrxus/use-owned-fd-for-btf
Use `OwnedFd` for BTF's file descriptor
1 year ago
Andrés Medina ea96c29ccb aya: Use Arc<OwnedFd> when loading BTF fd
This fixes an existing file descriptor leak when there is BTF data in
the loaded object.

To avoid lifetime issues while having minimal impact to UX the
`OwnedFd` returned from the BPF_BTF_LOAD syscall will be wrapped in an
`Arc` and shared accross the programs and maps of the loaded BPF
file.
1 year ago
Andrés Medina 683a1cf2e4 aya: Make SysResult generic on Ok variant 1 year ago
Andrés Medina c63d9904f7 Replace std::os::unix::io for std::os::fd
This is just taking https://github.com/aya-rs/aya/pull/633 to its
logical conclusion. Because `std::os::fd` was only introduced as a
module in Rust v1.66.0 I have also updated the `Cargo.toml` of the
`aya` package to reflect the true MSRV. Note that this commit is *not*
the cause for this MSRV bump, that was done by a previous commit, this
commit is just making it explicit in the `Cargo.toml`
1 year ago
ajwerner 1bc9a1ad04
Merge pull request #697 from aya-rs/log-env-too
integration-test: Remove RUSTC from cargo-in-cargo
1 year ago
Tamir Duberstein d62ae98889
integration-test: Remove RUSTC from cargo-in-cargo
Fixes #686.
1 year ago
Tamir Duberstein f334cbd86e
Merge pull request #693 from aya-rs/public-diff-backwards
xtask: reverse public API diff direction
1 year ago
Tamir Duberstein 8d7545aff8
xtask: reverse public API diff direction
This is currently producing inverse diffs.
1 year ago
Dave Tucker 41fc87c2e6
Merge pull request #691 from aya-rs/public-api-followup
public api followup
1 year ago
Tamir Duberstein 321bda7539
public-api: simplify and improve output 1 year ago
Tamir Duberstein 06d6a3e7a6
vscode: exclude public-api fixtures from search 1 year ago
ajwerner 8e144a5c29
Merge pull request #661 from ajwerner/integration-tests-in-release
integration-tests: run in release also
1 year ago
Dave Tucker e30df50fb7
Merge pull request #682 from dave-tucker/public-api
xtask: Add cargo-public-api
1 year ago
Dave Tucker f833f1fc1d xtask: Add cargo-public-api
Adds cargo-public-api. This allows for public API changes to get caught
in CI, requiring new changes to be "blessed" by using:

  cargo xtask public-api --bless

When this file is changed for aya, Alessandro will need to review the PR.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
1 year ago
Andrew Werner 7575628d1b integration-tests: run in release also
In release, the trigger functions were being optimized out and the
tests did not work. Use core::hint::black_box to ensure that the
functions are not optimized out. Also, run these integration tests
in CI to ensure that we don't regress.
1 year ago
Tamir Duberstein 53d36a3fe0
Merge pull request #688 from aya-rs/get-fd-owned
sys: bpf_prog_get_fd_by_id returns OwnedFd
1 year ago
Tamir Duberstein eb80e6f37e
Merge pull request #689 from aya-rs/parallel-ci
github: parallel all the CI
1 year ago
Tamir Duberstein d6322d2da3
github: parallel all the CI
Human time is more precious than computer time.
1 year ago
Tamir Duberstein 76c78e3bf8
sys: bpf_prog_get_fd_by_id returns OwnedFd 1 year ago
Tamir Duberstein 51cd36378a
Merge pull request #687 from ajwerner/cargo-args
xtask: allow arbitrary flags to cargo build
1 year ago
Tamir Duberstein a6b1fb9a1e xtask: allow arbitrary flags to cargo build 1 year ago