Commit Graph

1980 Commits (73a34e1571a606124c7e89ecf71ff001508643dc)
 

Author SHA1 Message Date
arctic-alpaca 73a34e1571 aya: Add `XskMap::unset` 1 week ago
Dave Tucker ea76e0f62d aya: parse complete entries from /proc/$pid/maps
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
1 week ago
Tamir Duberstein de0b7cee8d Destructure 1 week ago
Tamir Duberstein 7084df68aa Add punctuation 1 week ago
Tamir Duberstein 50ae0ee099 Avoid allocations when parsing /proc/{pid}/maps 1 week ago
Tamir Duberstein 6252b4c972 aya-obj,aya-ebpf-*: hook up loongarch64
This causes rustfmt to format those files.

Squish some other conditional compilation to get rustfmt sorting.
1 week ago
Tamir Duberstein 9916092f5c codegen: tidy up
- Document the need for external rustfmt invocation.
- Remove reexports.
- Remove `write_to_file`.
- Avoid allocating strings when using bindgen to write bindings.
1 week ago
Tamir Duberstein e16f0482f8 Revert "ci: remove cross toolchain"
Turns out this was actually being used through magic.

Remove mips since it is a tier 3 target that is only supported on
nightly and dtolnay/rust-toolchain doesn't seem to handle installing
targets without std.

Exclude xtask since it depends on `ring` which doesn't build on all
targets.

Fix compilation on armv7 which had rotted.

This reverts commit d92fc95c39.
1 week ago
Tamir Duberstein 34319cba12 ci,xtask: sort architectures 1 week ago
Tamir Duberstein b18b4f7369 ci: use output rather than env
This appeases my IDE and removes annoying yellow squiggles.
1 week ago
Tamir Duberstein 56ebe1406e aya-tool: do not attempt to run rustfmt
This can be done externally. Do so in CI.

This is an attempt to resolve the inconsistency between CI and local
rustfmt in the generated bindings.

Restore running CI on generated branches; the presence of a PR is
apparently not enough.
1 week ago
tamird 2bb2302d1d aya-obj, aya-ebpf-bindings: regenerate
libbpf commit: 20ea95b4505c477af3b6ff6ce9d19cee868ddc5d
1 week ago
Tamir Duberstein f0a9f19ddc Bump edition to 2024
Change FromRawTracepointArgs::arg to return T rather than *const T which
seems to have been returning a dangling pointer.

Arguably this is not strictly necessary; edition 2024 seems to be
focused on increased strictness around unsafe code which doesn't unlock
new functionality for our users. That said, this work revealed an
apparent bug (see above) that we wouldn't otherwise catch due to
allow-by-default lints.
1 week ago
Tamir Duberstein ea5f7e3015 Reduce the scope of expected warnings
This fixes a few safety comments to avoid the warnings.
1 week ago
Tamir Duberstein 4101a5a55d Use #[expect(...)] rather than #[allow(...)]
This is stricter, and revealed a few unused allowances.
1 week ago
arctic-alpaca 015443776c replace hard-coded queue ID with queried queue ID 1 week ago
arctic-alpaca e1cb4237bd tests: add queue ID matching to AF_XDP test 1 week ago
arctic-alpaca 4d2a56ed46 tests: avoid UB in AF_XDP test
Avoid calling `MaybeUninit::uninit().assume_init_mut()` by just
initializing the memory.
1 week ago
dave-tucker ce0e93c75d aya-obj, aya-ebpf-bindings: regenerate
libbpf commit: 20ea95b4505c477af3b6ff6ce9d19cee868ddc5d
1 week ago
Dave Tucker 85c0139428
Merge pull request #1197 from heiher/xtask-loong64
chore(xtask): Add loongarch64 to codegen
1 week ago
Tamir Duberstein 27d69c35f0 aya: remove panics on indeterminate kernel version
Cache the current kernel version in a thread-local while I'm here.

Closes https://github.com/aya-rs/aya/issues/1024.
Closes https://github.com/aya-rs/aya/pull/1042.
1 week ago
Tamir Duberstein 9eefb48a0a aya: remove some copies
Replace truncation with proper NULL termination at the site of use.
1 week ago
Tamir Duberstein 7525532204 ci: remove superfluous name
It's implied from the git URL.
1 week ago
Dave Tucker 0fa300f696
Merge pull request #1141 from gth828r/1140.xdp-context-if-index-support
aya-ebpf: add ifindex support to XdpContext
1 week ago
jinlong 2fb19f3ee2 feat: Add `set` for `Array<T>`
Signed-off-by: jinlong <jinlong@tencent.com>
1 week ago
Tamir Duberstein 601c89dd23 aya-ebpf: extract insert,remove,lookup
These functions (and more) are duplicated all over the place.
1 week ago
Tim Upthegrove dc543ae44a aya-ebpf: add ifindex support to XdpContext
This change exposes the ifindex field from the underlying xdp_md
data structure to the XdpContext in Aya. The ifindex represents the
unique OS-provided index for a network interface.

Fixes #1140
2 weeks ago
WANG Rui 9d0bdb56e6 chore(xtask): Add loongarch64 to codegen
Signed-off-by: WANG Rui <wangrui@loongson.cn>
2 weeks ago
Ignacy 3edac6153e integration-test: allow llvm-objcopy env override
Allows integration tests to run where llvm-objcopy is versioned.

Closes: https://github.com/aya-rs/aya/issues/1142
2 weeks ago
Tamir Duberstein 89aa638e05 aya: add TODO to remove once_cell 2 weeks ago
Tamir Duberstein de1e80c1d1 aya: encode perf_event ioctl contract
Enumerate the possible ioctls in an enum and bake in the knowledge that
they all return 0 on success and -1 on error.
2 weeks ago
Tamir Duberstein eee7975ce4 aya: remove redundant TEST_SYSCALL use
This is already done in `syscall`.
2 weeks ago
Tamir Duberstein 055e36e8d9 aya: encode perf_event_open(2) contract
Per man 2 perf_event_open:

> RETURN VALUE
>   On success, perf_event_open() returns the new file descriptor.  On
>   error, -1 is returned and errno is set to indicate the error.

Bake this into our syscalls so we stop using `_` so much which can hide
information loss. Remove the type parameter to SysResult.
2 weeks ago
Tamir Duberstein bdd8ae2d0b *: avoid `_`
This can silently discard information, so we shouldn't do it.
2 weeks ago
Tamir Duberstein f6df60fa70 aya: encode bpf(2) contract
Per man 2 bpf:

> RETURN VALUE
>   For a successful call, the return value depends on the operation:
>
>   BPF_MAP_CREATE
>     The new file descriptor associated with the eBPF map.
>
>   BPF_PROG_LOAD
>     The new file descriptor associated with the eBPF program.
>
>   All other commands
>     Zero.
>
>   On error, -1 is returned, and errno is set to indicate the error.

Bake this into our syscalls so we stop using `_` so much which can hide
information loss.
2 weeks ago
Tamir Duberstein 2d782606fe *: avoid Result::is_{ok,err}
These methods discard information. Discarding information is bad.
2 weeks ago
Tamir Duberstein a25e355ba7 ci: run on all branches
It is especially common to run CI on non-main branches in forks. This
shouldn't have any impact on how many CI jobs we run in the main aya
repo if contributors follow a fork-centric workflow.
2 weeks ago
Tamir Duberstein dab1aa4e29 maps: avoid retagging in tests 2 weeks ago
Tamir Duberstein f51ab80075 perf_buffer: attempt to preserve provenance
In tests, provide write provenance.
2 weeks ago
Tamir Duberstein 888701425b perf_buffer: use MMap from ring_buf 2 weeks ago
Tamir Duberstein ff82c244f7 netlink: avoiding casting pointers to usize 2 weeks ago
Tamir Duberstein e17feca2d6 maps: remove some stale comments 2 weeks ago
Tamir Duberstein 935ba20224 Enable test under miri
nr_cpus() is stubbed since 9e1bcd0ab8.
2 weeks ago
Tamir Duberstein 5ff57f1d9e Use `ignore` rather than not compile on big endian 2 weeks ago
Tamir Duberstein 9a47495227 aya,aya-obj: preserve pointer provenance 2 weeks ago
Tamir Duberstein b500a6326b tests: use `cfg!` to tidy up 2 weeks ago
Tamir Duberstein 122c49fca4 *: appease clippy
While I'm here convert a String to a PathBuf in an error to avoid lossy
conversions.

See https://rust-lang.github.io/rust-clippy/master/index.html#io_other_error.
2 weeks ago
tamird f49a761c27 aya-obj, aya-ebpf-bindings: regenerate
libbpf commit: 20ea95b4505c477af3b6ff6ce9d19cee868ddc5d
2 weeks ago
Tamir Duberstein 5d5b63dcb1 gen: run on ubuntu-latest
ubuntu-20.04 is being deprecated.

See https://github.com/actions/runner-images/issues/11101.
2 weeks ago
aorhant 9e1bcd0ab8 aya: Fix PerCpuHashMap NotFound
PerCpuHashMap was never returning MapError::KeyNotFound because
bpf_map_lookup_elem_per_cpu was replacing Ok(None) with
Ok(Some(zeroed_value)).

Update bpf_map_lookup_elem_per_cpu to map the Option value.
2 weeks ago