-
Notifications
You must be signed in to change notification settings - Fork 369
aya: add multi-uprobe attach support #1417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for aya-rs-docs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Introduce UProbe::attach_multi with UProbeMultiAttachOptions and per-location cookies. Require #[uprobe(multi)] programs (BPF_TRACE_UPROBE_MULTI) and guard unsupported kernels. Refactor symbol resolution into a single pass to batch lookups efficiently and add integration tests covering multi-attach success and rejecting non-multi programs
5beedeb to
374eba6
Compare
374eba6 to
bd05ab8
Compare
tamird
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tamird reviewed 8 of 13 files at r1.
Reviewable status: 8 of 14 files reviewed, 3 unresolved discussions (waiting on @swananan)
test/integration-test/src/tests/uprobe_multi.rs line 34 at r1 (raw file):
Some(map) => map, None => { eprintln!("skipping test because RING_BUF map is unavailable");
how can this happen? if it can't, please fail the test on it.
test/integration-ebpf/src/uprobe_multi.rs line 21 at r1 (raw file):
let cookie = unsafe { helpers::bpf_get_attach_cookie(ctx.as_ptr()) }; let cookie_bytes = cookie.to_le_bytes(); let _ = RING_BUF.output::<[u8]>(cookie_bytes, 0);
let _res to match existing style plz
aya/src/programs/uprobe.rs line 198 at r1 (raw file):
/// cookies; the list must be non-empty or the call fails with /// [`UProbeError::InvalidLocations`]. pub fn attach_multi(
does this need to be a separate function? The current attach already has an abstraction we can use (UProbeAttachLocation). We can change that type to allow it to model multiple attachment and implement conversion (From or Into) such that a user could pass a list to indicate multiple attachment. WDYT?
|
@tamird I used a separate That said, these are just instincts from a Rust newbie (I’ve been around Rust for a while now, but I still feel like a newbie 😂). Yeah, I’ve noticed the current If we go with a single |
|
Bundling the two makes sense to me. Perhaps that can happen in a standalone PR ahead of this one. |
This follows the aya-rs#1417 review discussion: by bundling location + cookie into a UProbeAttachPoint we get a more idiomatic Into<_> entry point, keep the one-to-one relationship enforced by the type system, and make it easier to extend attach with multi-location support without introducing parallel arrays or a brand new API.
This follows the aya-rs#1417 review discussion: by bundling location + cookie into a UProbeAttachPoint we get a more idiomatic Into<_> entry point, keep the one-to-one relationship enforced by the type system, and make it easier to extend attach with multi-location support without introducing parallel arrays or a brand new API.
This follows the aya-rs#1417 review discussion: by bundling location + cookie into a UProbeAttachPoint we get a more idiomatic Into<_> entry point, keep the one-to-one relationship enforced by the type system, and make it easier to extend attach with multi-location support without introducing parallel arrays or a brand new API.
This follows the #1417 review discussion: by bundling location + cookie into a UProbeAttachPoint we get a more idiomatic Into<_> entry point, keep the one-to-one relationship enforced by the type system, and make it easier to extend attach with multi-location support without introducing parallel arrays or a brand new API.
This PR tackles #992 and focuses on multi-attach uprobes.
Main talking points:
Refactors symbol resolution to batch lookups over a single object::File mmap, since repeated mmap/parse per location was too expensive for multi-attach workloads. I haven’t split out a dedicated symbol resolver yet because that felt heavier, but I’m open to doing this.
Introduces
#[uprobe(multi)]expectations, add attach-type checks, and emit friendlyProgramNotMulti/UProbeMultiNotSupportederrors. To keepcompiled_for_multiin sync,UProbecan no longer rely on the sharedimpl_from_prog_info!macro, so it now hand-rollsfrom_program_info(open to suggestions for a more reusable pattern).This change is