-
Notifications
You must be signed in to change notification settings - Fork 189
Implement --filter-non-skb-funcs #355
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
Conversation
fae4f99
to
ab70ae0
Compare
Signed-off-by: Zhichuan Liang <gray.liang@isovalent.com>
Usage: --filter-non-skb-funcs xfrm_state_look_at Signed-off-by: Zhichuan Liang <gray.liang@isovalent.com>
ab70ae0
to
1a048d0
Compare
u64 stackid = get_stackid(ctx); | ||
|
||
struct sk_buff **skb = bpf_map_lookup_elem(&stackid_skb, &stackid); | ||
if (skb && *skb) |
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.
Why if (skb)
is not enough?
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.
You are right, it's MS Copilot! Let me fix it.
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.
Okay.. you merged ...
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.
Amazing! I will cut a new release next week.
By enabling --filter-track-skb-by-stackid, we can track kernel functions without skb parameter.
For example, to observe xfrm state lookup, we can use command:
pwru --filter-non-skb-funcs xfrm_state_look_at,xfrm_state_lookup,xfrm_state_lookup_byaddr,xfrm_state_lookup_byspi
.Also, this is another step towards "tailcall tracing". This PR allows us to attach bpf helpers (that are probably not skb functions). By fetching bpf helpers' caller pc and converting pc into symbol, we'll see the bpf prog name.
Signed-off-by: Zhichuan Liang gray.liang@isovalent.com