-
Notifications
You must be signed in to change notification settings - Fork 712
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
link: support for kprobe session #1623
Conversation
2a2f948
to
d02c6b1
Compare
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.
Thanks for the patch!
I find it a bit of a missed opportunity that this requires user space to specify a different attach type to the link as it invites unnecessary complexity, adding corner cases to otherwise straightforward logic.
The kernel could attach the prog to entry and return if prog->expected_attach_type
is KPROBE_SESSION. What was the rationale here? Backwards compat?
I think the reason was to keep it similar to other links with having link->attach_type == prog->expected_attach_type, |
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
450704e
to
638d6b6
Compare
…sion) Adding support to attach kprobe multi link as session [1] by adding Session bool to KprobeMultiOptions. When set true it attaches the link with BPF_TRACE_KPROBE_SESSION attach_type, which means: - program is attached to both function entry and return - entry program can decided if the return program gets executed - entry program can share u64 cookie value with return program [1] https://lore.kernel.org/bpf/20240430112830.1184228-1-jolsa@kernel.org/ Signed-off-by: Jiri Olsa <jolsa@kernel.org> Co-authored-by: Timo Beckers <timo@isovalent.com>
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.
@olsajiri I've made a few changes:
- Session landed in 6.10, not 6.9.
TestKprobeSession
is now gated onhaveBPFLinkKprobeMulti()
(instead of the newhaveBPFLinkKprobeSession()
) so it's also exercised on kernels with multi but without session. This makes sure KprobeMulti correctly returnsErrNotSupported
on those kernels, which was previously broken, see next:- Feature probes are run before the blanket EINVAL check, which would previously always return the
missing kernel symbol or prog...
error instead of returningErrNotSupported
in the error path. - Added
TestHaveBPFLinkKprobeSession
to test the feature probe.
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.
Latest version looks good to me
kprobe session support plus 6.11 kernel update