[GIT PULL] probes: Fixes for for v7.0-rc3

Masami Hiramatsu (Google) posted 1 patch 3 weeks, 1 day ago
kernel/kprobes.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
[GIT PULL] probes: Fixes for for v7.0-rc3
Posted by Masami Hiramatsu (Google) 3 weeks, 1 day ago
Hi Linus,

Probes fixes for v7.0-rc3

- kprobes: avoid crash when rmmod/insmod after ftrace killed
  This fixes a kernel crash caused by kprobes on the symbol in a
  module which is unloaded after ftrace_kill() is called.
- kprobes: Remove unneeded warnings from __arm_kprobe_ftrace()
  Remove unneeded WARN messages which can be kicked if the kprobe is
  using ftrace and it fails to enable the ftrace. Since kprobes
  correctly handle such failure, we don't need to warn it.


Please pull the latest probes-fixes-v7.0-rc3 tree, which can be found at:


  git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
probes-fixes-v7.0-rc3

Tag SHA1: fc4d86187c58bac3a67170db07dce1eb61a75a17
Head SHA1: 5ef268cb7a0aac55521fd9881f1939fa94a8988e


Masami Hiramatsu (Google) (2):
      kprobes: avoid crash when rmmod/insmod after ftrace killed
      kprobes: Remove unneeded warnings from __arm_kprobe_ftrace()

----
 kernel/kprobes.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
---------------------------
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index ab25b4aa9095..bfc89083daa9 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -1144,12 +1144,12 @@ static int __arm_kprobe_ftrace(struct kprobe *p, struct ftrace_ops *ops,
 	lockdep_assert_held(&kprobe_mutex);
 
 	ret = ftrace_set_filter_ip(ops, (unsigned long)p->addr, 0, 0);
-	if (WARN_ONCE(ret < 0, "Failed to arm kprobe-ftrace at %pS (error %d)\n", p->addr, ret))
+	if (ret < 0)
 		return ret;
 
 	if (*cnt == 0) {
 		ret = register_ftrace_function(ops);
-		if (WARN(ret < 0, "Failed to register kprobe-ftrace (error %d)\n", ret)) {
+		if (ret < 0) {
 			/*
 			 * At this point, sinec ops is not registered, we should be sefe from
 			 * registering empty filter.
@@ -1178,6 +1178,10 @@ static int __disarm_kprobe_ftrace(struct kprobe *p, struct ftrace_ops *ops,
 	int ret;
 
 	lockdep_assert_held(&kprobe_mutex);
+	if (unlikely(kprobe_ftrace_disabled)) {
+		/* Now ftrace is disabled forever, disarm is already done. */
+		return 0;
+	}
 
 	if (*cnt == 1) {
 		ret = unregister_ftrace_function(ops);

-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>
Re: [GIT PULL] probes: Fixes for for v7.0-rc3
Posted by pr-tracker-bot@kernel.org 3 weeks, 1 day ago
The pull request you sent on Sun, 15 Mar 2026 20:32:12 +0900:

> git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git probes-fixes-v7.0-rc3

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/d9bf296c398d093f9641568411dee16285302113

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html