probes: Fixes for v7.1
Hi Linus,
Probes fixes for v7.1
- fprobe: Fixed several bugs, which includes followings:
. Prevention of re-registration: Added an earlier check to reject
re-registering an already active fprobe before its state is modified during the initialization phase.
. Robustness in failure paths:
- Ensured fprobes are correctly removed from all internal tables and properly RCU-freed during registration failure.
- Modified unregister_fprobe() to proceed with unregistration even if temporary memory allocation fails.
. RCU safety in module unloading: Avoided a potential "sleep in RCU"
warning by removing a kcalloc() call in the module notifier path. This also tries to remove fprobe_hash_node even if memory allocation fails.
. Type-aware unregistration: Fixed a bug where unregistering an fprobe
did not account for different types (entry-only vs. entry-exit) at the same address, which previously left "junk" entries in the underlying ftrace/fgraph ops.
. Unregistration of empty ftrace_ops: Avoided unneeded performance
overhead because of making registered ftrace_ops empty (means trace all functions.) This counts remaining entries and unregister ftrace_ops when it becomes empty.
- ftracetest: In addition to the fix, two new selftests to check above fixes, are included:
. Module Unloading Test: Specifically verifies that fprobe events on
a module are correctly cleaned up and do not trigger "trace-all" behavior when the module is removed.
. Multiple Fprobe Events Test: Ensures that having multiple fprobes on
the same function correctly manages the ftrace hash map during removal.
Please pull the latest probes-v7.1-2 tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
probes-v7.1-2
Tag SHA1: 02ae3fda580c7421659230990bd1520a908f9808 Head SHA1: 453553e1ed53ca364454e155ba33e110d02c75cd
Masami Hiramatsu (Google) (8):
tracing/fprobe: Reject registration of a registered fprobe before init tracing/fprobe: Unregister fprobe even if memory allocation fails tracing/fprobe: Remove fprobe from hash in failure path tracing/fprobe: Avoid kcalloc() in rcu_read_lock section tracing/fprobe: Check the same type fprobe on table as the unregistered one tracing/fprobe: Fix to unregister ftrace_ops if it is empty on module unloading selftests/ftrace: Add a testcase for fprobe events on module selftests/ftrace: Add a testcase for multiple fprobe events
----
kernel/trace/fprobe.c | 472 ++++++++++++++------- .../test.d/dynevent/add_remove_fprobe_module.tc | 87 ++++ .../test.d/dynevent/add_remove_multiple_fprobe.tc | 69 +++ 3 files changed, 466 insertions(+), 162 deletions(-) create mode 100644 tools/testing/selftests/ftrace/test.d/dynevent/add_remove_fprobe_module.tc create mode 100644 tools/testing/selftests/ftrace/test.d/dynevent/add_remove_multiple_fprobe.tc
---------------------------
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
The pull request you sent on Wed, 22 Apr 2026 09:54:18 +0900:
The pull request you sent on Wed, 22 Apr 2026 09:54:18 +0900:
Quoted 1 line
git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.gitprobes-v7.1-2
has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/beaba8bfbb91e3bb3133eacacd62fd6fea515e34
Thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html