Commit Graph

236 Commits (324c679a41ba7e5448092a0e5b1ca7e06adb78e2)

Author SHA1 Message Date
dave-tucker 324c679a41 Update libbpf to be89b28f96be426e30a2b0c5312d13b30ee518c7 3 years ago
Alessandro Decina 4e9bc32a3d aya: maps: rename from_pinned() to open_pinned() 3 years ago
Alessandro Decina f12054a00d
Merge pull request #165 from dave-tucker/prog_pinned
aya: Retrieve program from pinned path
3 years ago
Dave Tucker abc8d27440 aya: Retrieve program from pinned path
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
dave-tucker 0619f80090 Update libbpf to 22411acc4b2c846868fd570b2d9f3b016d2af2cb 3 years ago
Dave Tucker 83cfe56fe7 aya: allocate func/line_info buffers outside if
the pointer isn't valid in the current code!

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker 877c76043a btf: Add fixup for PTR types from Rust
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker 5c6131afba Add BPF_PROG_TYPE_EXT
This requires loading the BTF to kernel when loading all programs as
well as implementing Extension program type

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker 379bb313b1 obj: Add Btf::to_bytes
This allows for parsed BTF to be re-encoded such that it could be loaded
in to the kernel. It moves bytes_of to the utils package. We could use
Object::bytes_of, but this requires the impl of the Pod trait on
generated code.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker 65a0b83205 Mark .rodata maps as readonly and freeze on load
This commit marks .rodata maps as BPF_F_RDONLY_PROG when loaded to
prevent a BPF program mutating them.

Initial map data is populated by the loader using the new
`BpfLoader::set_global()` API. The loader will mark
is marked as frozen using bpf_map_freeze to prevent map data
being changed from userspace.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Dave Tucker 2b7dda766f btf: Fix for rename of BPF_ -> BPF_CORE_
Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
dave-tucker 05d4bc39ea Update libbpf to 19656636a9b9a2de1f71fa3135709295c16701cc 3 years ago
Michal Rostecki 7e2fcd1d6d Support for fentry and fexit programs
fentry and fexit programs are similar to kprobe and kretprobe, but they
are newer and they have practically zero overhead to call before or
after kernel function. Also, fexit programs are focused on access to
arguments rather than the return value.

Those kind of programs were introduced in the following patchset:

https://lwn.net/Articles/804112/

Signed-off-by: Michal Rostecki <mrostecki@opensuse.org>
3 years ago
dependabot[bot] 54b0c67795 build(deps): update object requirement from 0.27 to 0.28
Updates the requirements on [object](https://github.com/gimli-rs/object) to permit the latest version.
- [Release notes](https://github.com/gimli-rs/object/releases)
- [Changelog](https://github.com/gimli-rs/object/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gimli-rs/object/compare/0.27.0...0.28.1)

---
updated-dependencies:
- dependency-name: object
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
3 years ago
Ubuntu 24a292f605 Implement Pod for u128 3 years ago
dave-tucker 17d43cd6f8 Update libbpf to 93e89b34740c509406e948c78a404dd2fba67b8b 3 years ago
Alessandro Decina 26d188c659
Merge pull request #125 from dave-tucker/btf
obj: Improve section detection
3 years ago
Thia Wyrod 18970369e2
aya: Remove unnecessary unsafe markers on map iteration.
Map iteration can yield stale keys and values by virtue of sharing a
data structure with BPF programs which can modify it. However, all
accesses remain perfectly safe and will not cause memory corruption or
data races.
3 years ago
Alessandro Decina 07a6016ebb
Merge pull request #120 from eero-thia/thia/dedup
aya: eliminate name duplication in maps and programs.
3 years ago
Thia Wyrod f56dd0a70b
aya: eliminate name duplication in maps and programs.
Map and ProgramData objects had unnecessarily cloned strings for their
names, despite them being just as easily available to external users via
bpf.maps() and bpf.programs().
3 years ago
Will bb8a813eef aya: use correct program name when relocating 3 years ago
Dave Tucker e4d9774bf7 obj: Improve section detection
This commit improves section detection.
Previously, a section named "xdp_metadata" would be interpretted as a
program section, which is incorrect. This commit first attempts to
identify a BPF section by name, then by section.kind() ==
SectionKind::Text (executable code). The computed section kind is
stored in the Section so variants can be easily matched on later.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
Thia Wyrod daa7ea6d0d
aya: remove unnecessary usage of &dyn trait in favor of impl trait.
This should improve performance in most situations by eliminating
unnecessary fat pointer indirection.
3 years ago
Alessandro Decina 98b36b23bc
Merge pull request #116 from eero-thia/thia/close
aya: close file descriptors on Map drop.
3 years ago
Alessandro Decina 2955ca1d1f
Merge pull request #121 from eero-thia/thia/programs_mut
aya: programs_mut iterator to complement programs.
3 years ago
Thia Wyrod c7f8db9a0b
aya: programs_mut iterator to complement programs. 3 years ago
Thia Wyrod 1584bc47bd
aya: close file descriptors on Map drop. 3 years ago
Thia Wyrod f8f17a09fb
aya: expand include_bytes_aligned to accept expressions.
This allows one to this macro with literal expressions involving macros
such as concat! and env!.
3 years ago
Alessandro Decina 6db30fad9c
Merge pull request #108 from deverton/kprobe-debugfs
Support k/uprobes on older kernels.
3 years ago
Dan Everton 0e84610976
Refactoring after feedback. 3 years ago
Rust Plumber 761cb79fe3
aya: fix test warnings (#111) 3 years ago
Dan Everton 606c3267c4
Support pid filtering in debugfs 3 years ago
Dan Everton 1dc75542b4
Handle probe entry offsets 3 years ago
Dan Everton 4e6aeb2e69
Merge branch 'main' into kprobe-debugfs 3 years ago
Dan Everton 3dff6e8555
Updates based on feedback 3 years ago
Dan Everton 4277205e9d
Use current kernel version as default if not specified
When a BPF program doesn't specify the target kernel version, the
most compatible option is to set the program kernel version to match
the currently running kernel.
3 years ago
Dan Everton 42c9737d47
Functional detach of debugfs probes. 3 years ago
Dan Everton a4faabcf93
Fix event_alias comparison when looking in event list 3 years ago
Dan Everton 84fa2197ec
Don't duplicate perf_attach code and formatting 3 years ago
Dan Everton d0321bd1ee
Attempt auto detach of probe for debugfs 3 years ago
Dan Everton 34aa790a91
Support k/uprobes on older kernels.
Prior to kernel 4.17 probes were attached via debugfs and this patch
attempts to make that work.

Tested on kernel 4.14.
3 years ago
Dan Everton 07e3824aa4
chore: formatting 3 years ago
Dan Everton 49f6a8e819
Stub `kernel_version` for tests 3 years ago
Dan Everton d966881e46
Fix lint issues 3 years ago
Dan Everton fc0861105a
fix: make maps compatible with kernel <= 4.14
In kernel 4.15 and additional parameter was added to allow maps to have
names but using this breaks on older kernels.

This change makes it so the name is only added on kernels 4.15 and
newer.
3 years ago
Alessandro Decina 182182d840 (cargo-release) version 0.10.6 3 years ago
Dave Tucker 352e54b724 obj: fix name parsing for sk_skb sections
This commit fixes name parsing of sk_skb sections such that both named
and unnamed variants will work correctly.

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
3 years ago
alessandrod 4a7f47d93a Update libbpf to 16dfb4ffe4aed03fafc00e0557b1ce1310a09731 3 years ago
Tobias Klauser 2136f05461 aya: netlink: use NETLINK_EXT_ACK from libc crate
NETLINK_EXT_ACK is available since libc crate version 0.2.105, see
https://github.com/rust-lang/libc/releases/tag/0.2.105
3 years ago
William Findlay 1e6b1afbe4
aya/obj: fix incorrect section size for .bss 3 years ago