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
libbpf-tools: improve fentry_exists check #3917
Conversation
Are these failed checks a regression caused by this change? It looks like the failing tests involve the python tools, so I'm not sure I see how this would affect them. |
Agreed, test failures look unrelated. Will look into them separately. |
libbpf-tools/trace_helpers.c
Outdated
@@ -1042,7 +1065,7 @@ bool fentry_exists(const char *name, const char *mod) | |||
err_out: | |||
btf__free(btf); | |||
btf__free(base); | |||
return id > 0; | |||
return id > 0 ? fentry_can_attach(id) : false; |
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.
I think this commit will also close #3781 :)
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.
It should help, but I don't think all of the tools listed there use fentry_exists to fall back to kprobes
Looks like these are the tools which are affected by this change:
Just listing for posterity |
On architectures that lack support for fentry programs, tools should fall back to using kprobes even if the kernel version is new enough to include BPF_TRACE_FENTRY, but fentry_exists() cannot currently detect this case. Instead of searching for BPF_TRACE_FENTRY, verify that attaching a BPF_TRACE_FENTRY program can actually succeed. Rename fentry_exists to fentry_can_attach to reflect this change. Signed-off-by: Connor O'Brien <connoro@google.com> Change-Id: I5ad0341cb060c7a4a2ee17245337170963dfefad
3ba7c30
to
3787a0d
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.
LGTM, will merge after test run
On architectures that lack support for fentry programs, tools should
fall back to using kprobes even if the kernel version is new enough to
include BPF_TRACE_FENTRY, but fentry_exists() cannot currently detect
this case.
Add an additional check verifying that attaching a BPF_TRACE_FENTRY
program can actually succeed.
Signed-off-by: Connor O'Brien connoro@google.com