Skip to content
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

program: make it harder to attach Kretprobe via link.Kprobe and vice versa #1497

Open
lmb opened this issue Jun 25, 2024 · 0 comments · May be fixed by #1508
Open

program: make it harder to attach Kretprobe via link.Kprobe and vice versa #1497

lmb opened this issue Jun 25, 2024 · 0 comments · May be fixed by #1508
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@lmb
Copy link
Collaborator

lmb commented Jun 25, 2024

Kprobe and Kretprobe both have the same program type, so the library can't guard against using the wrong attachment hooks (see #1490 (comment)). Figuring out whether a program is a kretprobe currently involves doing a string match on ProgramSpec.SectionName. It would be nice to do one at least of the following.

  • Make it so that link.Kprobe returns an error when passed a Kretprobe program. This requires either figuring out whether a program is a Kretprobe (hard, because programs can be loaded from a pin) or communicating it to link.Kprobe somehow. Maybe we can shoehorn this into ProgramSpec.AttachTo somehow, which is often passed directly to link.Kprobe etc. But does this create other breakage?
  • Make it easier to figure out if a ProgramSpec is a Kretprobe somehow (though a method on ProgramSpec seems really ugly?)
  • Add an example which shows how to attach kprobe / kretprobe based on the SectionName.
@lmb lmb added enhancement New feature or request help wanted Extra attention is needed labels Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant