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

ebpf: Limit args access to kprobe/uprobe and ret access to kretprobe/uretprobe #912

Merged
merged 4 commits into from
Apr 24, 2024

Conversation

tyrone-wu
Copy link
Contributor

@tyrone-wu tyrone-wu commented Mar 26, 2024

Here's my stab at #700. Feel free to let me know if anything needs to be changed or if you're looking for something different. 🙂🙃

Separated args access to kprobe/uprobe and ret access to kretprobe/uretprobe by defining ProbeContext & RetProbeContext with only args & ret respectively. Then updated the procedural macros for kprobe/uprobe to only accept ProbeContext, and kretprobe/uretprobe to only accept RetProbeContext.

Fixes: #700

Copy link

netlify bot commented Mar 26, 2024

Deploy Preview for aya-rs-docs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 4c92505
🔍 Latest deploy log https://app.netlify.com/sites/aya-rs-docs/deploys/6625259460334f00081a407b
😎 Deploy Preview https://deploy-preview-912--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 mergify bot added aya-bpf This is about aya-bpf (kernel) test A PR that improves test cases or CI labels Mar 26, 2024
@tyrone-wu tyrone-wu marked this pull request as ready for review March 26, 2024 03:47
@tyrone-wu tyrone-wu marked this pull request as draft March 27, 2024 21:15
@alessandrod
Copy link
Collaborator

Hey! Sorry for the delay in reviewing this! Have had a busy couple of weeks but I plan to take a look in the next couple of days :)

@alessandrod
Copy link
Collaborator

Sorry it took so long! Looks great, if you mark as ready for review I'll approve. Also CI is failing, so please fix that.

Created retprobe.rs to hold RetProbeContext and moved the ret from
ProbeContext in probe.rs into RetProbeContext. Now, only kprobe (which
uses ProbeContext) can access args, and kretprobe (which uses
RetProbeContext) can access ret.

Fixes: aya-rs#700
Added logic in expand function in both kprobe.rs and uprobe.rs for valid
macros. Now, kprobe & uprobe proc macros only accept ProbeContext, and
kretprobe & uretprobe only accept RetProbeContext.

Ref: aya-rs#700
Added integration test methods for kretprobe and uretprobe with their
appropriate contexts.
@tyrone-wu tyrone-wu force-pushed the ebpf/split-probe-retprobe-ctx branch from 649165f to b0d24cd Compare April 21, 2024 14:06
@tyrone-wu tyrone-wu marked this pull request as ready for review April 21, 2024 14:58
@tyrone-wu
Copy link
Contributor Author

tyrone-wu commented Apr 21, 2024

Lint errors are now resolved. 🐱
I'll also go ahead and update aya-template with these changes as well.

tyrone-wu added a commit to tyrone-wu/aya-template that referenced this pull request Apr 21, 2024
Update kretprobe and uretprobe to use RetProbeContext in response to the
changes from aya-rs/aya#912
tyrone-wu added a commit to tyrone-wu/aya-template that referenced this pull request Apr 21, 2024
Update kretprobe and uretprobe to use RetProbeContext in response to
aya-rs/aya#700 and aya-rs/aya#912
tyrone-wu added a commit to tyrone-wu/aya-template that referenced this pull request Apr 21, 2024
Update kretprobe and uretprobe to use RetProbeContext in response to
aya-rs/aya#700 and aya-rs/aya#912
Copy link
Collaborator

@alessandrod alessandrod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, great work!

@alessandrod alessandrod merged commit 1cf3d3c into aya-rs:main Apr 24, 2024
21 checks passed
tyrone-wu added a commit to tyrone-wu/aya-template that referenced this pull request May 29, 2024
Update kretprobe and uretprobe to use RetProbeContext in response to
aya-rs/aya#700 and aya-rs/aya#912
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aya-bpf This is about aya-bpf (kernel) test A PR that improves test cases or CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Separate KProbe and KRetProbe
2 participants