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 guardrails for valid combinations of perf_event `type` and `config` fields #1038

Open tyrone-wu opened 2 months ago

tyrone-wu commented 2 months ago

Add guardrails for when setting event type and config for perf_event program. The added PerfEventConfig enum now defines the event type and config of interest.

Idiomatic Rust types are added for:

The motivation behind this is mainly for the type and config fields of bpf_link_info.perf_event.event (in a separate branch). I plan to use these newly added enums bpf_link_info metadata. https://elixir.bootlin.com/linux/v6.10/source/include/uapi/linux/bpf.h#L6714

One thing to note is that although Breakpoint/PERF_TYPE_BREAKPOINT variant exists, it is not fully implemented at the moment (due to some additional fields need in perf_event_attr like bp_type, etc.). It's only usage currently will be in retrieving link info.


I have it named as PerfEventConfig as the moment. I'm not too sure on the naming tho. :/


This change is Reviewable

netlify[bot] commented 2 months ago

Deploy Preview for aya-rs-docs ready!

Built without sensitive environment variables

Name Link
Latest commit c5be26776b5649707fd24b99bd82a1b9c8b77260
Latest deploy log https://app.netlify.com/sites/aya-rs-docs/deploys/6713c1cfe7ccf900088ef0a0
Deploy Preview https://deploy-preview-1038--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 2 months ago

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

mergify[bot] commented 1 month ago

@tyrone-wu, this pull request is now in conflict and requires a rebase.

mergify[bot] commented 1 week ago

@tyrone-wu, this pull request is now in conflict and requires a rebase.