Commit Graph

177 Commits (a89f69e1abddf4825e7a45ba2a1c7dfd20ae8df9)

Author SHA1 Message Date
Dave Tucker a89f69e1ab aya: Implement Maps/Arrays of Maps
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Alessandro Decina 4152e8b1a4 (cargo-release) version 0.10.5 3 years ago
Alessandro Decina 59a1854a6b aya: fix call relocation bug
Take the section offset into account when looking up relocation entries
3 years ago
Dave Tucker dc4b928ec5 miri: Disable Stacked Borrows and skip some tests
The perf_buffer code fails due to stacked borrows, skip this for now.
munmap isn't supported by miri.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Alessandro Decina 52c51895ba aya: fix clippy 3 years ago
Alessandro Decina 64e3fb4cc8 aya: improve docs a bit and make BpfLoader default to loading BTF if available 3 years ago
Alessandro Decina 5f8f18e3a1 aya: loader: take BTF info as reference
Allows sharing the same BTF info across many loaders
3 years ago
Dave Tucker 9426f36f79 Implement Pinning For Programs and Maps
This commit adds 2 new methods to aya::sys
- bpf_pin_object
- bpf_get_object

Which allow the pinning and retrieval of programs/maps to bpffs.

It adds a `Program.pin` API, such that a loaded program can be pinned.
For map pinning, the user must ensure the `pinning u32` in the
`bpf_map_def` is set to 1, maps will be pinned using a new builder API.

BpfLoader::new().map_pin_path("/sys/fs/bpf/myapp").load_file("myapp.o")

This will pin all maps whose definition requests pinning to path + name.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Alessandro Decina a7f5b3775d (cargo-release) version 0.10.4 3 years ago
Dave Tucker a10a7b3bf2 bump obj to 0.26
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Alessandro Decina 98361a4c93 aya: minor PerfEvent API tweaks 3 years ago
Alessandro Decina b0a05e759e aya: run xtask codegen aya 3 years ago
Markus Stange c39dff6025 Add support for PerfEvent programs. 3 years ago
Alessandro Decina c56a6b16aa aya: only consider Text symbols as relocatable functions 3 years ago
Alessandro Decina d9fc0f484f aya: fix bug with nested call relocations
Use the correct offset when looking up relocation entries while doing
nested call relocations.
3 years ago
Dave Tucker e9bad0b61d Make Clippy Happy
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Alessandro Decina 9c27910f76 aya: update authors and repository link 3 years ago
Dave Tucker 8acb92d61c Remove docs. Update URLs to aya-rs
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker 4e1ce2534c obj/btf: Fix size of Unknown variant
The size of Unknown should be ty_size, otherwise when it is encountered,
we never advance the cursor and it creates an infinite loop.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker 569b8ca39e obj/btf: Add some tests for reading btf data
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker 753a683704 btf: Add bindings for BTF_KIND_FLOAT
Fixes: #34

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Alessandro Decina f30abca15e (cargo-release) version 0.10.3 3 years ago
Alessandro Decina 66a12ffcf7 aya: programs: tweak LircMode2::query doc. 3 years ago
Alessandro Decina 8c03ba052a aya: netlink: fix clippy lint 3 years ago
Sean Young 81e07e9661
Implement query for lirc programs (#32)
Signed-off-by: Sean Young <sean@mess.org>
3 years ago
Alessandro Decina fa2cbe2f82 aya: fix clippy warnings 3 years ago
Alessandro Decina c2a90c2c01 aya: tc: add qdisc_detach_program
qdisc_detach_program can be used to detach all the programs that have
the given name. It's useful when you want to detach programs that were
attached by some other process (eg. iproute2), or when you want to
detach programs that were previously left attached because the program
that attached them was killed.
3 years ago
Alessandro Decina 0a9d02140a aya: netlink: fix alignment when writing attributes 3 years ago
Alessandro Decina abb199e6f4 aya: netlink: fix handling of multipart messages 3 years ago
Alessandro Decina 9185f32f6f aya: tc: clean up netlink code a bit 3 years ago
Simone Margaritelli b4b019e447
fix: pass BTF object by reference in order to allow multiple eBPF programs to share it and save memory (closes #30). (#31) 3 years ago
Alessandro Decina d996a88de4 aya: fix formatting 3 years ago
Alessandro Decina 0878c4505a aya: fix clippy warnings 3 years ago
Alessandro Decina 21e01df242 aya: obj: improve parse_map_def tests
Add a test that checks that we handle ELF section padding correctly and
simplify the other tests.
3 years ago
Alessandro Decina b657930a3e aya: don't error out parsing padded map sections
Fixes #28
3 years ago
Simone Margaritelli 8311abfdcb
added support for armv7-unknown-linux-gnueabi and armv7-unknown-linux-gnueabihf
* new: added support for armv7-unknown-linux-gnueabi (closes alessandrod/aya/issues/22)

* fix: replaced custom type defintions with proper libc types

* fix: fixed pointless parameter binding

* new: added linker for armv7-unknown-linux-gnueabihf to cargo config
3 years ago
Alessandro Decina 9c8e78b7d4 aya: tc: make qdisc_add_clsact return io::Error 3 years ago
Alessandro Decina 122a5306e7 aya, aya-bpf-bindings: regenerate bindings 3 years ago
Alessandro Decina 08c71dfeb1 aya: kprobe: remove pid argument
Kprobes can only be attached globally. Per-pid logic needs to be
implemented on the BPF side with bpf_get_current_pid_tgid.
3 years ago
Arnabjyoti Kalita 35f15f70e0
aya: add minimum kernel version for each map and program type (#18) 3 years ago
Alessandro Decina bb15e82c1d aya: add missing load() in kprobe example
Fixes #17
3 years ago
Rafael Ortiz d8d311738c
aya: support both bpf_map_def layout variants
Libbpf and iproute2 use two slightly different `bpf_map_def` layouts. This change implements support for loading both.

Refs: #10, #14
3 years ago
Alessandro Decina 5f0ff1698a aya: netlink: tc: use ptr::read_unaligned instead of deferencing a potentially unaligned ptr 3 years ago
Alessandro Decina 7f2ceaf12e aya: netlink: port TC code to using new nlattr utils 3 years ago
Alessandro Decina d9b5ab575f aya: netlink: refactor nlattr writing code 3 years ago
Alessandro Decina c240a2c733 aya: netlink: introduce NestedAttrs builder and switch XDP to it
NestedAttrs is a safe interface for writing nlattrs. This is the first
step towards making the netlink code safer and easier to maintain.
3 years ago
Alessandro Decina bb595c4e69 aya: refactor program section parsing
This renames aya::obj::ProgramKind to aya::obj::ProgramSection and moves
all the program section parsing to ProgramSection::from_str.
3 years ago
Alessandro Decina 0188622580 aya: fix tracepoint prefix in a couple more places 3 years ago
Alessandro Decina a0151dd485 aya: fix trace point section name
Trace points have prefix "tracepoint" not "trace_point".
3 years ago
Alessandro Decina 521ef09463
Merge pull request #4 from seanyoung/doctest
Fix doctest and run them during CI
3 years ago