Commit Graph

1759 Commits (cd1db86fd490b3c0f03229bd8999a2e67ccecfc4)
 

Author SHA1 Message Date
Billy McFall cd1db86fd4 aya: adjust bpf programs for big endian
In aya/src/sys/bpf.rs, there are several simple bpf programs written as
byte arrays. These need to be adjusted to account for big endian.

Signed-off-by: Billy McFall <22157057+Billy99@users.noreply.github.com>
3 weeks ago
Billy McFall b513af12e8 aya: add archs powerpc64 and s390x to aya
bpfman, a project using aya, has a requirement to support powerpc64 and
s390x architectures. Adding these two architectures to aya.

Signed-off-by: Billy McFall <22157057+Billy99@users.noreply.github.com>
3 weeks ago
Billy McFall eef7346fb2 test: adjust test byte arrays for big endian
Adding support for s390x (big endian architecture) and found that some
of the unit tests have structures and files implemented as byte arrays.
They are all coded as little endian and need a bug endian version to
work properly.

Signed-off-by: Billy McFall <22157057+Billy99@users.noreply.github.com>
3 weeks ago
Tamir Duberstein 4362020691 Simplify doctest 4 weeks ago
Tamir Duberstein bce3c4fb1d Appease nightly clippy
```
error: first doc comment paragraph is too long
  --> aya/src/programs/raw_trace_point.rs:12:1
   |
12 | / /// A program that can be attached at a pre-defined kernel trace point, but also
13 | | /// has an access to kernel internal arguments of trace points, which
14 | | /// differentiates them from traditional tracepoint eBPF programs.
15 | | ///
16 | | /// The kernel provides a set of pre-defined trace points that eBPF programs can
   | |_
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_long_first_doc_paragraph

error: first doc comment paragraph is too long
  --> ebpf/aya-ebpf/src/helpers.rs:1:1
   |
1  | / //! This module contains kernel helper functions that may be exposed to specific BPF
2  | | //! program types. These helpers can be used to perform common tasks, query and operate on
3  | | //! data exposed by the kernel, and perform some operations that would normally be denied
4  | | //! by the BPF verifier.
5  | | //!
6  | | //! Here, we provide some higher-level wrappers around the underlying kernel helpers, but
   | |_
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_long_first_doc_paragraph
```
4 weeks ago
Andrew Stoycos 47b0dde395
Merge pull request #1013 from astoycos/bump-int
Add a 6.10 linux kernel to the virtualized testing in CI
4 weeks ago
astoycos 25beb14ff0
run virtualized CI on multiple kernels
Ensure we download multiple kernel versions to run
our virtualized CI against.

Bump xdpilone version to fix bug on latest kernel.

Signed-off-by: astoycos <astoycos@gmail.com>
1 month ago
dependabot[bot] a54532f848 build(deps): bump the cargo-crates group across 1 directory with 2 updates
Updates the requirements on [bindgen](https://github.com/rust-lang/rust-bindgen) and [public-api](https://github.com/cargo-public-api/cargo-public-api) to permit the latest version.

Updates `bindgen` to 0.69.4
- [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.69.0...v0.69.4)

Updates `public-api` to 0.36.0
- [Release notes](https://github.com/cargo-public-api/cargo-public-api/releases)
- [Changelog](https://github.com/cargo-public-api/cargo-public-api/blob/main/rustdoc-json/CHANGELOG.md)
- [Commits](https://github.com/cargo-public-api/cargo-public-api/compare/public-api-v0.36.0...public-api-v0.36.0)

---
updated-dependencies:
- dependency-name: bindgen
  dependency-type: direct:production
  dependency-group: cargo-crates
- dependency-name: public-api
  dependency-type: direct:production
  dependency-group: cargo-crates
...

Signed-off-by: dependabot[bot] <support@github.com>
1 month ago
Tamir Duberstein 23ece3d794 public-api: regenerate
See https://github.com/rust-lang/rust/pull/126877, I think.
1 month ago
Dave Tucker bdbd0423f8
Merge pull request #1010 from aya-rs/codegen
Update libbpf to b07dfe3b2a6cb0905e883510f22f9f7c0bb66d0d
1 month ago
Dave Tucker 9a138870f3 chore(xtask): Bless API changes
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
1 month ago
dave-tucker e2177278ae [codegen] Update libbpf to b07dfe3b2a6cb0905e883510f22f9f7c0bb66d0dUpdate libbpf to b07dfe3b2a6cb0905e883510f22f9f7c0bb66d0d
Files changed:
M	ebpf/aya-ebpf-bindings/src/aarch64/bindings.rs
M	ebpf/aya-ebpf-bindings/src/armv7/bindings.rs
M	ebpf/aya-ebpf-bindings/src/powerpc64/bindings.rs
M	ebpf/aya-ebpf-bindings/src/riscv64/bindings.rs
M	ebpf/aya-ebpf-bindings/src/s390x/bindings.rs
M	ebpf/aya-ebpf-bindings/src/x86_64/bindings.rs
1 month ago
Dave Tucker 2a459a4005
Merge pull request #1006 from astoycos/tcx-return
codegen: add `tcx_action_base` enum to bindings
1 month ago
astoycos a52ad4ba2a codegen: add `tcx_action_base` enum to bindings
Signed-off-by: astoycos <astoycos@gmail.com>
1 month ago
Tamir Duberstein 41619933d6 Revert "Remove unused `allow(dead_code)`"
This reverts commit 5397c1ca4b.
1 month ago
Dave Tucker 3d57d358e4 fix(aya): Fix PerfEventArray resize logic
There was a logic bug in the previously merged patch where we
set the correctly calculated max_entries size with the original.

To fix this and prevent regressions a unit test was added.
This highlighted that the original map definition needs to be
mutated in order for the max_entries change to be properly applied.

As such, this resize logic moved out of aya::sys into aya::maps

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 months ago
Michal Rostecki e575712c59 chore: Add comments in `*_wrong_map` tests 2 months ago
Dave Tucker 25d986a26d fix(aya): Set PerfEventArray max_entries to nCPUs
Both libbpf and cilium/ebpf have will set the max_entries of a
BPF_MAP_TYPE_PERF_EVENT_ARRAY to the number of online CPUs if
it was omitted at map definition time. This adds that same
logic to Aya.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 months ago
Dave Tucker ef0d1253ef fix(ebpf): Remove PerfEventArray::with_max_entries
This API doesn't make sense as the max_entries needs to be set to the
number of online CPUs by the loader.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 months ago
Tamir Duberstein e12fcf46cb Use MockableFd everywhere
Rust 1.80 contains https://github.com/rust-lang/rust/pull/124210,
causing tests which we skip under miri to segfault.
2 months ago
Michal Rostecki a167554b8b ci: Use apt repository with LLVM 18 explicitly
The unversioned one is suffering from LLVM 19 => 20 migration issues,
see llvm/llvm-project#100466.
2 months ago
Tamir Duberstein 956dd01375 Install Rust toolchain later
`brew` seems to be breaking the rustup installed by rust-toolchain:

```
==> Migrating formula rustup-init to rustup
==> Unlinking rustup-init
==> Moving rustup-init versions to /opt/homebrew/Cellar/rustup
==> Relinking rustup
```

Let's see if this fixes it.
2 months ago
Tamir Duberstein 4025861780 Don't hardcode /usr/local/opt 2 months ago
Tamir Duberstein 28545d3331 Use macos-13 2 months ago
Tamir Duberstein 247486cb7d Remove stale workaround 2 months ago
Tamir Duberstein 5397c1ca4b Remove unused `allow(dead_code)`
See 31fe9628cf.
2 months ago
Michal Rostecki 6dab7176f5 chore: Bless public API 2 months ago
Michal Rostecki a75fc2f769 aya-log: Allow logging `core::net::Ipv4Addr` and `core::net::Ipv6Addr`
IP address types are available in `core`, so they can be used also in
eBPF programs. This change adds support of these types in aya-log.

* Add implementation of `WriteTuBuf` to these types.
* Support these types in `Ipv4Formatter` and `Ipv6Formatter`.
* Support them with `DisplayHint::Ip`.
* Add support for formatting `[u8; 4]`, to be able to handle
  `Ipv4Addr::octets`.
2 months ago
ajwerner 2cd9858ea9
Merge pull request #991 from l2dy/typo-1
docs(aya): fix typo
2 months ago
Zero King f1773d5af4 docs(aya): fix typo 2 months ago
Dave Tucker 8015e10079
Merge pull request #989 from aya-rs/codegen
Update libbpf to 686f600bca59e107af4040d0838ca2b02c14ff50
2 months ago
dave-tucker 8d7446e011 [codegen] Update libbpf to 686f600bca59e107af4040d0838ca2b02c14ff50
Update libbpf to 686f600bca59e107af4040d0838ca2b02c14ff50

Files changed:
M	aya-obj/src/generated/linux_bindings_aarch64.rs
M	aya-obj/src/generated/linux_bindings_armv7.rs
M	aya-obj/src/generated/linux_bindings_powerpc64.rs
M	aya-obj/src/generated/linux_bindings_riscv64.rs
M	aya-obj/src/generated/linux_bindings_s390x.rs
M	aya-obj/src/generated/linux_bindings_x86_64.rs

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
2 months ago
Dave Tucker 104f449c0f
Merge pull request #988 from tyrone-wu/codegen/bpf-stats-type
codegen: add `bpf_stats_type` to codegen
2 months ago
tyrone-wu 86e279ef0a
codegen: add bpf_stats_type
Added `bpf_stats_type` enum to codegen bindings.

Refs: #959
2 months ago
Dave Tucker d5414bf10c
Merge pull request #983 from ajwerner/fix-variable-name
aya::programs::uprobe: fix bad variable name
2 months ago
Andrew Werner d413e2f285 aya::programs::uprobe: fix bad variable name
The variable fn_name was very much *not* the fn_name, but rather the
object file path.
2 months ago
Wouter Dullaert b8a22fa040 feat(aya-ebpf): Add memmove to the public-api 3 months ago
Wouter Dullaert fb0a339adf feat(aya-ebpf): Add integration test for memmove implementation 3 months ago
Wouter Dullaert 7ad3926d99 feat(aya-ebpf): Implement memmove
The compiler will emit this function for certain operations, but aya
currently does not provide an implementation.
This leads to ebpf loading failures as the kernel can't find the symbol when
loading the program.

The implementation is based on https://github.com/rust-lang/compiler-builtins/blob/master/src/mem/mod.rs#L29-L40
and https://github.com/rust-lang/compiler-builtins/blob/master/src/mem/impls.rs#L128-L135
Only the simplest case has been implemented, none of the word optimizations,
since memcpy also doesn't seem to have them.
3 months ago
dependabot[bot] 09815d3c0c
Merge pull request #980 from aya-rs/dependabot/cargo/cargo-crates-95ee854e2a 3 months ago
dependabot[bot] d581431d9a
build(deps): update public-api requirement in the cargo-crates group
Updates the requirements on [public-api](https://github.com/Enselic/cargo-public-api) to permit the latest version.

Updates `public-api` to 0.35.1
- [Release notes](https://github.com/Enselic/cargo-public-api/releases)
- [Changelog](https://github.com/Enselic/cargo-public-api/blob/main/rustdoc-json/CHANGELOG.md)
- [Commits](https://github.com/Enselic/cargo-public-api/compare/public-api-v0.35.0...public-api-v0.35.1)

---
updated-dependencies:
- dependency-name: public-api
  dependency-type: direct:production
  dependency-group: cargo-crates
...

Signed-off-by: dependabot[bot] <support@github.com>
3 months ago
Tamir Duberstein bac059fd41 Bump kernel image revision
6.1.0-15 seems to have been pulled.
3 months ago
Dave Tucker 06aa5c8ed3
Merge pull request #978 from aya-rs/codegen
Update libbpf to c1a6c770c46c6e78ad6755bf596c23a4e6f6b216
3 months ago
dave-tucker 8b50a6a573 [codegen] Update libbpf to c1a6c770c46c6e78ad6755bf596c23a4e6f6b216
Update libbpf to c1a6c770c46c6e78ad6755bf596c23a4e6f6b216

Files changed:
M	aya-obj/src/generated/linux_bindings_aarch64.rs
M	aya-obj/src/generated/linux_bindings_armv7.rs
A	aya-obj/src/generated/linux_bindings_powerpc64.rs
M	aya-obj/src/generated/linux_bindings_riscv64.rs
A	aya-obj/src/generated/linux_bindings_s390x.rs
M	aya-obj/src/generated/linux_bindings_x86_64.rs
M	ebpf/aya-ebpf-bindings/src/aarch64/bindings.rs
M	ebpf/aya-ebpf-bindings/src/armv7/bindings.rs
A	ebpf/aya-ebpf-bindings/src/powerpc64/bindings.rs
A	ebpf/aya-ebpf-bindings/src/powerpc64/helpers.rs
M	ebpf/aya-ebpf-bindings/src/riscv64/bindings.rs
A	ebpf/aya-ebpf-bindings/src/s390x/bindings.rs
A	ebpf/aya-ebpf-bindings/src/s390x/helpers.rs
M	ebpf/aya-ebpf-bindings/src/x86_64/bindings.rs

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 months ago
Dave Tucker c34abd6418
Merge pull request #977 from dave-tucker/xtask-codegen-fix
chore(xtask): Create bindings dir
3 months ago
Dave Tucker b20b1f1b0a chore(xtask): Create bindings dir
If the bindings directory doesn't exist then create it.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 months ago
Dave Tucker 3bd71925cf
Merge pull request #976 from dave-tucker/fix-codegen-2
ci: Fix codegen and prep for s390/ppc64el
3 months ago
Dave Tucker 64ec062c84 ci: Fix codegen and prep for s390/ppc64el
Adds missing libelf headers that are now included
as part of libbpf-internal.h. Adds ppc64el and
s390x to the cross environment.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 months ago
Dave Tucker 3fc6f47281
Merge pull request #975 from dave-tucker/s390-ppc-codegen
chore(xtask): Add s390x and powerpc64 to codegen
3 months ago
Billy McFall 62efed1853 chore(xtask): Add s390x and powerpc64 to codegen
This commit adds the s390x and powerpc architectures
to codegen. This will enable an upcoming PR to add
support for aya to support theses architectures
in both aya and aya-ebpf.

Co-authored-by: Dave Tucker <dave@dtucker.co.uk>
Signed-off-by: Billy McFall <22157057+Billy99@users.noreply.github.com>
3 months ago