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
link/kprobe: specify symbol offset #613
Conversation
Signed-off-by: Tonghao Zhang <zhangtonghao@didiglobal.com>
Signed-off-by: Tonghao Zhang <zhangtonghao@didiglobal.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.
Missing some comments/documentation. Looks fine otherwise.
@@ -49,6 +49,8 @@ type KprobeOptions struct { | |||
// | |||
// Needs kernel 5.15+. | |||
Cookie uint64 | |||
// Kprobe symbol offset. |
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.
This needs more context. How is it used? Why is it necessary? How would the caller determine the correct offset to use?
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.
Hi, This offset is used for kprobe, because some functions in kernel is static or inline, we can't insert one probe. but we can use probe the caller with offset. This "offset" is same as tracefs kprobe_events
https://www.kernel.org/doc/html/latest/trace/kprobetrace.html
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.
// Kprobe symbol offset. | |
// Offset of the kprobe relative to the traced symbol. | |
// Can be used to insert kprobes at arbitrary offsets in kernel functions, | |
// e.g. in places where functions have been inlined. |
Adding a test similar to |
Signed-off-by: Tonghao Zhang <zhangtonghao@didiglobal.com>
Signed-off-by: Tonghao Zhang zhangtonghao@didiglobal.com