-
Notifications
You must be signed in to change notification settings - Fork 291
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
WIP: auto-attach tracepoints based on SEC() data #1057
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 site configuration. |
Hey! Thanks for the PR!
For things where it makes sense - for example tracepoints that in most cases have exactly 1 attach target - yes I think it makes sense.
Yes, see CgroupSkb where we expose already https://docs.rs/aya/latest/aya/programs/cgroup_skb/struct.CgroupSkb.html#method.expected_attach_type
This for sure - we want to be as compatible with libbpf as possible.
This is a separate question, and I think it requires a bit more thinking, eg:
I think it's counter intuitive that some programs wouldn't get attached. Not sure what the solution would be. What does libbpf do? |
I would add k(ret)probe's to the list then :). I can do some research on which programs can be auto-attached in libbpf.
The code is here: https://github.com/libbpf/libbpf/blob/7984737fbf3b2a14a86321387bb62abb16cfc4ed/src/libbpf.c#L12365-L12404 So it looks like some conventions to prevent autoattachment: https://github.com/libbpf/libbpf/blob/7984737fbf3b2a14a86321387bb62abb16cfc4ed/src/libbpf.c#L747-L757 and some program types are simply not autoattached. Otherwise, a fail to auto-attach will simply cause an error. That overall seems like reasonable to me! |
Yep for sure - ideally we get to 100% libbpf compatibility.
I don't like that in the case of |
@Ablu, this pull request is now in conflict and requires a rebase. |
This is mostly a conversation starter. The work originated in me asking about this on Discord [1].
I can try to flesh this out to a full solution, but I have some questions on what the ideal solution looks like:
Question 1: Currently I am mostly seeing these
SEC()
annotations in C bpf programs. The automatic template generator of the aya-ebpf tracepoints does not seem to populate the fields (tough it looks like they are supported!). Should we populate those fields there too?libbpf-tools generates those .skel.h headers that allow automating the attach. I find that a nice QoL improvement over manually having to attach all the probes.
Question 2: I assume we also want to expose public getters for these fields?
Question 3: Do we want to extend this to all of the other "well-known"
SEC()
annotations that libbpf-tools uses? This would allow us to have a centralauto_attach()
that simply iterates over all programs and attaches them all?Open TODOs:
[1] https://discord.com/channels/855676609003651072/855676609003651075/1288759816612741120
This change is