Commit Graph

226 Commits (1df3b17d291f5a38de10280a7025f963dea18ee8)

Author SHA1 Message Date
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>
4 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>
4 years ago
Dave Tucker 569b8ca39e obj/btf: Add some tests for reading btf data
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
4 years ago
Dave Tucker 753a683704 btf: Add bindings for BTF_KIND_FLOAT
Fixes: #34

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
4 years ago
Alessandro Decina f30abca15e (cargo-release) version 0.10.3 4 years ago
Alessandro Decina 66a12ffcf7 aya: programs: tweak LircMode2::query doc. 4 years ago
Alessandro Decina 8c03ba052a aya: netlink: fix clippy lint 4 years ago
Sean Young 81e07e9661
Implement query for lirc programs (#32)
Signed-off-by: Sean Young <sean@mess.org>
4 years ago
Alessandro Decina fa2cbe2f82 aya: fix clippy warnings 4 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.
4 years ago
Alessandro Decina 0a9d02140a aya: netlink: fix alignment when writing attributes 4 years ago
Alessandro Decina abb199e6f4 aya: netlink: fix handling of multipart messages 4 years ago
Alessandro Decina 9185f32f6f aya: tc: clean up netlink code a bit 4 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) 4 years ago
Alessandro Decina d996a88de4 aya: fix formatting 4 years ago
Alessandro Decina 0878c4505a aya: fix clippy warnings 4 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.
4 years ago
Alessandro Decina b657930a3e aya: don't error out parsing padded map sections
Fixes #28
4 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
4 years ago
Alessandro Decina 9c8e78b7d4 aya: tc: make qdisc_add_clsact return io::Error 4 years ago
Alessandro Decina 122a5306e7 aya, aya-bpf-bindings: regenerate bindings 4 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.
4 years ago
Arnabjyoti Kalita 35f15f70e0
aya: add minimum kernel version for each map and program type (#18) 4 years ago
Alessandro Decina bb15e82c1d aya: add missing load() in kprobe example
Fixes #17
4 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
4 years ago
Alessandro Decina 5f0ff1698a aya: netlink: tc: use ptr::read_unaligned instead of deferencing a potentially unaligned ptr 4 years ago
Alessandro Decina 7f2ceaf12e aya: netlink: port TC code to using new nlattr utils 4 years ago
Alessandro Decina d9b5ab575f aya: netlink: refactor nlattr writing code 4 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.
4 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.
4 years ago
Alessandro Decina 0188622580 aya: fix tracepoint prefix in a couple more places 4 years ago
Alessandro Decina a0151dd485 aya: fix trace point section name
Trace points have prefix "tracepoint" not "trace_point".
4 years ago
Alessandro Decina 521ef09463
Merge pull request #4 from seanyoung/doctest
Fix doctest and run them during CI
4 years ago
Alessandro Decina d70e291580 (cargo-release) version 0.10.2 4 years ago
Alessandro Decina fee71b42f1 aya: tc: fix QdiscRequest layout 4 years ago
Sean Young 1196ba1dcc Fix doctest and run them during CI
Signed-off-by: Sean Young <sean@mess.org>
4 years ago
Sean Young b49ba69d09 Add support for lirc programs
Signed-off-by: Sean Young <sean@mess.org>
4 years ago
Alessandro Decina 304abfbfeb (cargo-release) version 0.10.1 4 years ago
LOU Xun f1fc30411d
Fix Bpf::load_file when BTF doesn't exist 4 years ago
Alessandro Decina 94b5e2e4e6 Copy readme into aya/ 4 years ago
Alessandro Decina 7694bacf04 aya: add more fields to Cargo.toml 4 years ago
Alessandro Decina be0b7bbd83 Doc fixes 4 years ago
Alessandro Decina 9f7b017d5d aya: bump version to 0.10 4 years ago
Alessandro Decina 768640dd46 aya: add doc aliases for maps and programs 4 years ago
Alessandro Decina 293e66af65 More docs 4 years ago
Alessandro Decina ad58e171ff aya: refactor tc code a bit and add docs 4 years ago
Alessandro Decina 11e21e83be More docs 4 years ago
Alessandro Decina 6c7df27bd0 More doc fixes 4 years ago
Alessandro Decina 28158e6028 aya: improve async perf map docs 4 years ago
Alessandro Decina 6ecf7dabf3 aya: tweak PerfEventArray docs 4 years ago
Alessandro Decina 6772595f3e aya: ProgramArray: more doc fixes 4 years ago
Alessandro Decina 4bde0c54bd aya: ProgramArray: tweak docs 4 years ago
Alessandro Decina 2cda5dbbe7 aya: implement ProgramFd for CgroupSkb 4 years ago
Alessandro Decina 2d7b9b2e90 aya: fix CgroupSkb docs 4 years ago
Alessandro Decina 08a68faf8a aya: programs: add support for BPF_PROG_TYPE_CGROUP_SKB programs 4 years ago
Alessandro Decina fb3e2f7f9d aya: programs: fix detaching programs attached with bpf_prog_attach 4 years ago
Alessandro Decina 665802594c aya: programs: fix syscall name in errors 4 years ago
Alessandro Decina 81a0b61164 aya: handle reordered functions
LLVM will split .text into .text.hot .text.unlikely etc and move the
content around in order to improve locality. We need to parse all the
text sections or relocations can potentially fail.
4 years ago
Alessandro Decina b92b1e18a9 aya: improve call relocation error messages 4 years ago
Alessandro Decina 20b2d4c77d aya: BpfError: set the #[source] attribute for RelocationErrors 4 years ago
Arnabjyoti Kalita 6974d349e8
programs: add support for attaching and detaching TC programs
This change adds support for attaching TC programs directly from aya, without
having to use iproute2/tc.
4 years ago
Alessandro Decina 31f8d71604 aya: add support for Stack and Queue maps 4 years ago
Alessandro Decina 40b7da6655 aya: add id and pinning fields to bpf_map_def 4 years ago
Alessandro Decina dc4e020f29 aya: netlink: improve error messages 4 years ago
Alessandro Decina 5effc972ac aya: add support for BPF_PROG_TYPE_SCHED_CLS programs 4 years ago
Alessandro Decina 4222b140ec aya: perf_map: fix bug when max_entries=0
When a perf map has max_entries=0, max_entries is dynamically set at
load time to the number of possible cpus as reported by
/sys/devices/system/cpu/possible.

This change fixes a bug where instead of setting max_entries to the
number of possible cpus, we were setting it to the cpu index of the last
possible cpu.
4 years ago
Alessandro Decina 3b7ffd0048 aya: update generated bindings
Update generated bindings with kernel headers from libbpf 4ccc1f0
4 years ago
Alessandro Decina 30d2b25f11 aya: xdp: fix detaching on kernels older than 5.7
XDP_FLAGS_REPLACE was added in 5.7. Now for kernels >= 5.7 whenever we
detach an XDP program we pass along the program fd we expect to be
detaching. For older kernels, we just detach whatever is attached, which
is not great but it's the way the API worked pre XDP_FLAGS_REPLACE.
4 years ago
Alessandro Decina 607cf68a69 aya: xdp: set flags when attaching with netlink 4 years ago
Alessandro Decina bb7728a2c5 aya: fix BpfError display strings 4 years ago
Alessandro Decina 9e12c9324c aya: fix warnings 4 years ago
Alessandro Decina 9a24f20e6f aya: programs: rework load_program() retry code a bit 4 years ago
Alessandro Decina 144175434f aya: programs: add support for SkMsg programs 4 years ago
Alessandro Decina dad300c88b aya: maps: add SockHash 4 years ago
Alessandro Decina ca4b3bfc04 aya: add support for SockOps programs 4 years ago
Alessandro Decina b57cace941 aya: add support BPF_PROG_TYPE_SK_SKB programs and SockMaps 4 years ago
Alessandro Decina b6cd813af5 aya: fix program array key size 4 years ago
Alessandro Decina 0b3e532d7a aya: small doc fixes 4 years ago
Alessandro Decina 79f1b385a5 aya: more docs 4 years ago
Alessandro Decina 683a58ea6d aya: consolidate errors into ProgramError::SyscallError 4 years ago
Alessandro Decina ae863bc663 aya: split aya::programs::probe into ::kprobe and ::uprobe & add docs 4 years ago
Alessandro Decina d9634ae945 aya: add maps::StackTraceMap
Map type for BPF_MAP_TYPE_STACK_TRACE.
4 years ago
Alessandro Decina 67c9cc0359 aya: add util::kernel_symbols()
kernel_symbols() can be used to load /proc/kallsyms in a BTreeMap.
Useful for looking up symbols from stack addresses.
4 years ago
Alessandro Decina 2cdb10e7f2 aya: add bpf_map_lookup_elem_ptr 4 years ago