Commit Graph

1923 Commits (8af5f380561d53daa6ba45497484e64b86f0ca7b)
 

Author SHA1 Message Date
Tamir Duberstein 8af5f38056 gen: run automatically 2 weeks ago
Tamir Duberstein 83b791223f gen: remove pointless "update"
libbpf is a submodule, so its version is already effectively pinned.
`xtask codegen` also runs `git submodule update` which reverts the
action of updating to `origin/HEAD`. Remove the cruft.
2 weeks ago
Tamir Duberstein 76d1b9f46e gen: use peter-evans/create-pull-request@v7
We already use this for the lint job on main.
2 weeks ago
Tamir Duberstein c8f14b18d4 codegen: tidy up
Move some code out of a loop, where it appears to be nonsense.
2 weeks ago
Tamir Duberstein 9198335100 codegen: remove outdated workaround
bindgen can handle these macros now.
2 weeks ago
Tamir Duberstein ed92e7eb66 aya-tool: use write_all 2 weeks ago
tamird 76ca85c8c3 public-api: regenerate 2 weeks ago
Tamir Duberstein 942ea51906 Avoid handwritten assembly 2 weeks ago
Tamir Duberstein 8ea11ef9e8 Remove duplication
Use `BPF_PROG_TYPE_TRACEPOINT` instead of `BPF_PROG_TYPE_SOCKET_FILTER`
as the former seems to work with more feature detection functions.
2 weeks ago
Tamir Duberstein b010b0f028 Avoid raw slice construction
The safety requirements of this transmutation are simpler.
2 weeks ago
Tamir Duberstein 94c857261a aya-obj: use generated constants 2 weeks ago
tamird e82253c915 chore(aya-obj, aya-ebpf-bindings): Regenerate bindings
libbpf commit: d4a841a32b04d69194ab5bdac359a51938a206ce

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_mips.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
M	xtask/public-api/aya-obj.txt
3 weeks ago
Tamir Duberstein 2319770f5b codegen: generate additional userspace constants 3 weeks ago
Tamir Duberstein ee7861a6ed codegen: avoid lossy string conversion
This can't possibly work right if lossy conversion is required.
3 weeks ago
Tyrone Wu 665d4f20bb chore: remove aya_obj -> obj alias
When `aya::obj` was migrated to be its own crate `aya-obj`, the `obj`
alias was created to preserve existing imports that relied on
`crate::obj`.

This resulted in 3 ways to import `aya-obj` objects:
- `use aya_obj::*`
- `use obj::*`
- `use crate::obj::*`

The `obj` alias is now removed to avoid confusion, and all `obj` imports
are funneled through `aya_obj`.
3 weeks ago
Dave Tucker 67a0595f87
Merge pull request #1159 from dave-tucker/codegen-pr-message
ci: Update codegen PR template
3 weeks ago
Dave Tucker 921e45747b
Merge pull request #690 from dave-tucker/netlink-errors
aya: Return error messages from netlink
3 weeks ago
Dave Tucker 39cf6c12f2 feat(aya): Return error messages from netlink
This returns error strings from netlink since they are more informative
than the raw os error. For example:

"Device or Resource Busy" vs. "XDP program already attached".

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 weeks ago
Dave Tucker 5d27e62b6a ci: Update codegen PR template
Updated to match the commit message

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 weeks ago
Dave Tucker 0865e08dcf
Merge pull request #1158 from aya-rs/codegen
Update libbpf to d4a841a32b04d69194ab5bdac359a51938a206ce
3 weeks ago
dave-tucker b686d6a245 chore(aya-obj, aya-ebpf-bindings): Regenerate bindings
libbpf commit: d4a841a32b04d69194ab5bdac359a51938a206ce

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_mips.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
M	xtask/public-api/aya-obj.txt
3 weeks ago
Dave Tucker 5942fe3702
Merge pull request #1157 from dave-tucker/codegen-improvements
ci: Improve Codegen Workflow
3 weeks ago
Dave Tucker 34be19a24d ci: Improve Codegen Workflow
1. Bless public-api changes
2. (Hopefully) fix the commit message

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 weeks ago
Dave Tucker 9ddee3552d
Merge pull request #1156 from dave-tucker/nlmsgerr_attrs
chore(codegen): Add nlmsgerr_attrs
3 weeks ago
Dave Tucker b16ca6f570 chore(codegen): Add nlmsgerr_attrs
This is required for nicer netlink error messages

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 weeks ago
Dave Tucker 2f757b2091
Merge pull request #482 from ishanjain28/add_mips_support
Added MIPS bindings
3 weeks ago
Dave Tucker 2eaae09c31 chore(aya-ebpf-cty): Add mips support
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 weeks ago
Dave Tucker 1495a93c45 ci: Include mips architecture in tests
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 weeks ago
Dave Tucker 1ccac3c135 feat(ebpf): Implement FromPtRegs for mips
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 weeks ago
Ishan Jain 3ff609114e feat(aya): Added MIPS bindings
Updated `aya-obj/src/generated/mod.rs` and
`bpf/aya-bpf-bindings/src/lib.rs to use the mips bindings.
3 weeks ago
Dave Tucker 66da8742fe
Merge pull request #1155 from aya-rs/codegen
Update libbpf to 324f3c3846d99c8a1e1384a55591f893f0ae5de4
3 weeks ago
dave-tucker 701a933345 [codegen] Update libbpf to 324f3c3846d99c8a1e1384a55591f893f0ae5de4
Update libbpf to 324f3c3846d99c8a1e1384a55591f893f0ae5de4

Files changed:
M	aya-obj/src/generated/btf_internal_bindings.rs
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_mips.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
M	ebpf/aya-ebpf-bindings/src/aarch64/bindings.rs
M	ebpf/aya-ebpf-bindings/src/armv7/bindings.rs
A	ebpf/aya-ebpf-bindings/src/mips/bindings.rs
A	ebpf/aya-ebpf-bindings/src/mips/helpers.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
3 weeks ago
Dave Tucker fdd25cd434
Merge pull request #1154 from dave-tucker/fix-codegen
chore(codegen): Fix duplicate BPF_F_LINK
3 weeks ago
Dave Tucker d92284e4f8 chore(codegen): Fix duplicate BPF_F_LINK
Per the comment added in the code, there are 2 definitions of
BPF_F_LINK in the kernel headers. Once is in an anonymous enum which
bindgen will constify, and once is via a #define macro. The values are
identical. The fix is to exclude BPF_F_LINK from the list of variables
in bindgen removing one of the duplicate definitions.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 weeks ago
Dave Tucker b960fd27b3
Merge pull request #1152 from dave-tucker/codegen-mips
ci: Install libc6-dev-mips-cross for codegen
3 weeks ago
Dave Tucker 3b41205059 ci: Install libc6-dev-mips-cross for codegen
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 weeks ago
Dave Tucker fd30e2e809
Merge pull request #1151 from dave-tucker/task-fd-query
chore(xtask): Add bindings for bpf_task_fd_type
3 weeks ago
Dave Tucker 74fad66599 chore(xtask): Add bindings for bpf_task_fd_type
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 weeks ago
Dave Tucker 16ca7256fc
Merge pull request #1150 from dave-tucker/mips-codegen
chore(xtask): Add mips to codegen
3 weeks ago
Ishan Jain 91fb73092e chore(xtask): Add mips to codegen
This will generate bindings for mips the next time that the codegen job
is run.

Signed-off-by: Ishan Jain <contact@ishanjain.me>
Co-authored-by: Dave Tucker <dave@dtucker.co.uk>
3 weeks ago
Tamir Duberstein 0429ed2fa2 Appease clippy
```
error: manual implementation of `ok`
   --> aya/src/util.rs:261:28
    |
261 |                   let addr = match u64::from_str_radix(addr, 16) {
    |  ____________________________^
262 | |                     Ok(addr) => Some(addr),
263 | |                     Err(ParseIntError { .. }) => None,
264 | |                 }?;
    | |_________________^ help: replace with: `u64::from_str_radix(addr, 16).ok()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_ok_err

error: struct pattern is not needed for a unit variant
    --> aya-obj/src/obj.rs:1705:44
     |
1705 |             section: ProgramSection::KProbe { .. },
     |                                            ^^^^^^^ help: remove the struct pattern
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unneeded_struct_pattern
note: the lint level is defined here
    --> aya-obj/src/lib.rs:68:9
     |
68   | #![deny(clippy::all, missing_docs)]
     |         ^^^^^^^^^^^
     = note: `#[deny(clippy::unneeded_struct_pattern)]` implied by `#[deny(clippy::all)]`

error: struct pattern is not needed for a unit variant
    --> aya-obj/src/obj.rs:1769:44
     |
1769 |             section: ProgramSection::KProbe { .. },
     |                                            ^^^^^^^ help: remove the struct pattern
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unneeded_struct_pattern

error: struct pattern is not needed for a unit variant
    --> aya-obj/src/obj.rs:1787:44
     |
1787 |             section: ProgramSection::KProbe { .. },
     |                                            ^^^^^^^ help: remove the struct pattern
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unneeded_struct_pattern

error: struct pattern is not needed for a unit variant
    --> aya-obj/src/obj.rs:1919:48
     |
1919 |                 section: ProgramSection::KProbe { .. },
     |                                                ^^^^^^^ help: remove the struct pattern
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unneeded_struct_pattern

error: struct pattern is not needed for a unit variant
    --> aya-obj/src/obj.rs:2041:52
     |
2041 |                 section: ProgramSection::TracePoint { .. },
     |                                                    ^^^^^^^ help: remove the struct pattern
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unneeded_struct_pattern

error: struct pattern is not needed for a unit variant
    --> aya-obj/src/obj.rs:2058:52
     |
2058 |                 section: ProgramSection::TracePoint { .. },
     |                                                    ^^^^^^^ help: remove the struct pattern
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unneeded_struct_pattern

error: struct pattern is not needed for a unit variant
    --> aya-obj/src/obj.rs:2081:54
     |
2081 |                 section: ProgramSection::SocketFilter { .. },
     |                                                      ^^^^^^^ help: remove the struct pattern
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unneeded_struct_pattern

error: struct pattern is not needed for a unit variant
    --> aya-obj/src/obj.rs:2151:55
     |
2151 |                 section: ProgramSection::RawTracePoint { .. },
     |                                                       ^^^^^^^ help: remove the struct pattern
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unneeded_struct_pattern

error: struct pattern is not needed for a unit variant
    --> aya-obj/src/obj.rs:2168:55
     |
2168 |                 section: ProgramSection::RawTracePoint { .. },
     |                                                       ^^^^^^^ help: remove the struct pattern
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unneeded_struct_pattern

error: struct pattern is not needed for a unit variant
    --> aya-obj/src/obj.rs:2243:55
     |
2243 |                 section: ProgramSection::BtfTracePoint { .. },
     |                                                       ^^^^^^^ help: remove the struct pattern
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unneeded_struct_pattern

error: struct pattern is not needed for a unit variant
    --> aya-obj/src/obj.rs:2266:59
     |
2266 |                 section: ProgramSection::SkSkbStreamParser { .. },
     |                                                           ^^^^^^^ help: remove the struct pattern
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unneeded_struct_pattern

error: struct pattern is not needed for a unit variant
    --> aya-obj/src/obj.rs:2289:59
     |
2289 |                 section: ProgramSection::SkSkbStreamParser { .. },
     |                                                           ^^^^^^^ help: remove the struct pattern
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unneeded_struct_pattern

error: struct pattern is not needed for a unit variant
    --> aya-obj/src/obj.rs:2410:58
     |
2410 |                 section: ProgramSection::CgroupSkbIngress { .. },
     |                                                          ^^^^^^^ help: remove the struct pattern
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unneeded_struct_pattern

error: struct pattern is not needed for a unit variant
    --> aya-obj/src/obj.rs:2433:58
     |
2433 |                 section: ProgramSection::CgroupSkbIngress { .. },
     |                                                          ^^^^^^^ help: remove the struct pattern
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unneeded_struct_pattern

error: struct pattern is not needed for a unit variant
    --> aya-obj/src/obj.rs:2456:51
     |
2456 |                 section: ProgramSection::CgroupSkb { .. },
     |                                                   ^^^^^^^ help: remove the struct pattern
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unneeded_struct_pattern

error: struct pattern is not needed for a unit variant
    --> aya-obj/src/obj.rs:2479:51
     |
2479 |                 section: ProgramSection::CgroupSkb { .. },
     |                                                   ^^^^^^^ help: remove the struct pattern
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unneeded_struct_pattern

error: manual implementation of `ok`
   --> aya-log-common/src/lib.rs:168:36
    |
168 |       let wire_len: LogValueLength = match value.len().try_into() {
    |  ____________________________________^
169 | |         Ok(wire_len) => Some(wire_len),
170 | |         Err(TryFromIntError { .. }) => None,
171 | |     }?;
    | |_____^ help: replace with: `value.len().try_into().ok()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_ok_err

error: manual implementation of `err`
   --> init/src/main.rs:141:30
    |
141 |           .filter_map(|result| match result {
    |  ______________________________^
142 | |             Ok(()) => None,
143 | |             Err(err) => Some(err),
144 | |         })
    | |_________^ help: replace with: `result.err()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_ok_err

error: manual implementation of `err`
  --> xtask/src/public_api.rs:80:30
   |
80 |           .filter_map(|result| match result {
   |  ______________________________^
81 | |             Ok(()) => None,
82 | |             Err(err) => Some(err),
83 | |         })
   | |_________^ help: replace with: `result.err()`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_ok_err
```
3 weeks ago
Tamir Duberstein 2907bc678d ci: add ARM runner
Remove gcc-multilib which doesn't exist on arm64.
3 weeks ago
Tamir Duberstein e46fae7459 Update public-api to 0.43.0 4 weeks ago
Eric Long 1fe12b9990
Fix aya-ebpf-* riscv64 build (#1139)
bpf_target_arch should be riscv64, but target triple starts with riscv64gc (and possibly riscv64 followed by any combination of extensions).
1 month ago
tamird 29b821376e public-api: regenerate 1 month ago
Tamir Duberstein 356cf45914 Use Set (instead of Map) to hold links
This uses hashbrown instead of std because the latter relies on Borrow
which requires a reference; hashbrown's Equivalent is more flexible.
1 month ago
Tamir Duberstein 69144a977e Appease clippy
```
error: called `Iterator::last` on a `DoubleEndedIterator`; this will needlessly iterate the entire iterator
   --> aya/src/programs/uprobe.rs:282:64
    |
282 |             let path = line.split(|b| b.is_ascii_whitespace()).last()?;
    |                                                                ^^^^^^ help: try: `next_back()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#double_ended_iterator_last
```
1 month ago
ajwerner 114e7a6906
Merge pull request #1133 from ajwerner/uprobe-cookie 1 month ago
Andrew Werner 628b7fb022 aya::programs::uprobe: add support for cookies
Fixes #1132.

Note that this change does not add support in the public API for kprobes
or tracepoints, but it's a trivial matter of plumbing.

Along the way, the Uprobe::attach API is cleaned up to make the
attachment location more coherent. The logic being: if we're going to be
breaking the API anyway, may as well clean it up a bit.

Furthermore, the aya::sys::bpf_link_attach function is cleaned up by
properly modeling the the union in the final field with a rust enum.
1 month ago
Mike Rostecki f34d355d7d bpf: Handle raw tracepoint arguments
Provide an `arg()` method in `RawTracepointArgs` wrapper of
`bpf_raw_tracepoint_args` and also in `RawTracepointContext`, so
it's directly available in raw tracepoint programs.

The methods and traits implemented here are unsafe. There is no
way to reliably check the number of available arguments, so
requesting a non-existing one leads to undefined behavior.
2 months ago