[PATCH v10 0/8] tracing/fprobe: Fix fprobe_ip_table related bugs

From: Masami Hiramatsu (Google)

Date: Mon Apr 20 2026 - 11:01:11 EST


Hi,

Here is the 10th version of fprobe bugfix series.
The previous version is here.

https://lore.kernel.org/all/177644266147.584467.8179035927318998910.stgit@xxxxxxxxxxxxxxxxxxxxxxxxxxxx/

This version fixes minor bugs. Add an RCU sync when fprobe
registration failed [3/8], call __fprobe_f*_unregister()
if there is no node on hash table even if it fails to allocate
working memory [6/8]. And fix to check "normalized" module
name in error path [7/8].

Sashiko pointed other issues[1],

[1] https://sashiko.dev/#/patchset/177644266147.584467.8179035927318998910.stgit%40mhiramat.tok.corp.google.com

- Is there a missing RCU read-side critical section here?
-> No, it is under preemption disabled. It seems a preempt
disabling is stronger restriction for RCU read-side critical
section.

- Does the error fallback path leave dangling pointers in the global hash
table?
Yes, but it is not introduced by this, and is fixed by [3/8].

Thank you!

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


base-commit: e0a384434ae1bdfb03954c46c464e3dbd3223ad6
--
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>