aya-rs / aya

Aya is an eBPF library for the Rust programming language, built with a focus on developer experience and operability.
https://aya-rs.dev/book/
Apache License 2.0
3.25k stars 291 forks source link

aya: add feature probing for program and map type #1063

Open tyrone-wu opened 1 month ago

tyrone-wu commented 1 month ago

Add API for detecting whether kernel supports program type and map type.

Also add const fn bpf_insn::new(...) so that common bpf instructions are not re-computed every time from copy_instructions().

Assertions for LircMode2 and Lsm are disabled because they require certain kernel configs to be enabled, which are not by default in VM integration tests. Same with InodeStorage map assertion.


I tested the new integration tests against a ton of ubuntu mainline kernels. Basically on every version where the program/map type was introduced I was able to verify that they were passing as expected, except for ones below v4.4 since it gave errors on /sys/fs/bpf ENOENT: No such file or directory.


This change is Reviewable

netlify[bot] commented 1 month ago

Deploy Preview for aya-rs-docs ready!

Built without sensitive environment variables

Name Link
Latest commit 6075a11bbf9d27abddd55533398deb3665edb2b9
Latest deploy log https://app.netlify.com/sites/aya-rs-docs/deploys/671a8b1c5011250008100ed3
Deploy Preview https://deploy-preview-1063--aya-rs-docs.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

mergify[bot] commented 1 month ago

Hey @alessandrod, this pull request changes the Aya Public API and requires your review.