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

conflict with ftrace function_graph #160

Open
dtcccc opened this issue Sep 29, 2022 · 2 comments
Open

conflict with ftrace function_graph #160

dtcccc opened this issue Sep 29, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@dtcccc
Copy link
Collaborator

dtcccc commented Sep 29, 2022

When running tools/testing/selftests/bpf/test_ftrace.sh on kernel 5.10, I found ftrace shutdown due to conflict with the interface functions.

This is because:
"echo function_graph > current_tracer" enables function_graph, and ftrace will try to modify many functions (including interface functions).
The check in ftrace_verify_code() will fail and causing the whole ftrace shutdown.

@dtcccc
Copy link
Collaborator Author

dtcccc commented Sep 30, 2022

Just like commit b91e014f078e ("bpf: Make BPF trampoline use register_ftrace_direct() API"), we can use the API of ftrace to let it know we've already occupied the function entry.
However this still remains several problems (conflicts with function_graph, fentry/fexit, etc). They will just return -EBUSY, instead of directly shutdown (this is a good news).

@dtcccc
Copy link
Collaborator Author

dtcccc commented Sep 30, 2022

Plan B: borrow from bpf trampoline
do sth. like bpf_trampoline_get() and modify tr->func.addr directly.
then call bpf_trampoline_update()

So that we will have a trampoline like:
bpf fentry();
plugsched function(); <------- we modify this!
bpf fexit();

@ampresent ampresent added the bug Something isn't working label Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants