The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [GIT PULL] probes: Fixes for v7.2-rc5
@ 2026-07-29 23:53 Masami Hiramatsu
  2026-07-30  0:16 ` pr-tracker-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Masami Hiramatsu @ 2026-07-29 23:53 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Masami Hiramatsu, Raushan Patel, Steven Rostedt, Masami Hiramatsu,
	linux-kernel

Hi Linus,

Probes fixes for v7.2-rc5:

- tracing/probes: Reject $arg0 in meta argument expansion
  Reject $arg0 during meta-argument expansion to prevent negative index
  calculation and out-of-bounds reading of traceprobe parameters.

- tracing/fprobe: Roll back on enable_trace_fprobe() failure
  Add a rollback cleanup path when __register_trace_fprobe() fails
  partway through to unregister registered probes and clear flags or
  file links.

- fprobe: Fix module reference count leak on error in register_fprobe()
  Ensure the module_put() cleanup loop runs even when get_ips_from_filter()
  returns an error, preventing module reference count leaks.


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


  git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
probes-fixes-v7.2-rc5

Tag SHA1: 5778b1358adb798fbe1c2ac1381be8bce98b60fc
Head SHA1: 8cf2f40ceb85047ad8a84dffae3bebc9fed18216


Masami Hiramatsu (Google) (1):
      fprobe: Fix module reference count leak on error in register_fprobe()

Raushan Patel (2):
      tracing/probes: Reject $arg0 in meta argument expansion
      tracing/fprobe: Roll back on enable_trace_fprobe() failure

----
 kernel/trace/fprobe.c       |  6 ++----
 kernel/trace/trace_fprobe.c | 12 +++++++++++-
 kernel/trace/trace_probe.c  |  6 +++++-
 3 files changed, 18 insertions(+), 6 deletions(-)
---------------------------
diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c
index f215990b9061..f681015413b8 100644
--- a/kernel/trace/fprobe.c
+++ b/kernel/trace/fprobe.c
@@ -961,10 +961,8 @@ int register_fprobe(struct fprobe *fp, const char *filter, const char *notfilter
 		return -ENOMEM;
 
 	ret = get_ips_from_filter(filter, notfilter, addrs, mods, num);
-	if (ret < 0)
-		return ret;
-
-	ret = register_fprobe_ips(fp, addrs, ret);
+	if (ret >= 0)
+		ret = register_fprobe_ips(fp, addrs, ret);
 
 	for (int i = 0; i < num; i++) {
 		if (mods[i])
diff --git a/kernel/trace/trace_fprobe.c b/kernel/trace/trace_fprobe.c
index 9f5f08c0e7c2..3120403a5b60 100644
--- a/kernel/trace/trace_fprobe.c
+++ b/kernel/trace/trace_fprobe.c
@@ -1481,11 +1481,21 @@ static int enable_trace_fprobe(struct trace_event_call *call,
 		list_for_each_entry(tf, trace_probe_probe_list(tp), tp.list) {
 			ret = __register_trace_fprobe(tf);
 			if (ret < 0)
-				return ret;
+				goto err;
 		}
 	}
 
 	return 0;
+
+err:
+	/* Failed to enable one of them. Roll back all */
+	list_for_each_entry(tf, trace_probe_probe_list(tp), tp.list)
+		__unregister_trace_fprobe(tf);
+	if (file)
+		trace_probe_remove_file(tp, file);
+	else
+		trace_probe_clear_flag(tp, TP_FLAG_PROFILE);
+	return ret;
 }
 
 /*
diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 506e6037e163..c8fd9b946f44 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -1901,7 +1901,11 @@ const char **traceprobe_expand_meta_args(int argc, const char *argv[],
 				trace_probe_log_err(0, BAD_VAR);
 				return ERR_PTR(-ENOENT);
 			}
-			/* Note: $argN starts from $arg1 */
+			/* Note: $argN starts from $arg1, so $arg0 is invalid. */
+			if (n == 0) {
+				trace_probe_log_err(0, BAD_ARG_NUM);
+				return ERR_PTR(-EINVAL);
+			}
 			ret = sprint_nth_btf_arg(n - 1, type, buf + used,
 						 bufsize - used, ctx);
 			if (ret < 0)

-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [GIT PULL] probes: Fixes for v7.2-rc5
  2026-07-29 23:53 [GIT PULL] probes: Fixes for v7.2-rc5 Masami Hiramatsu
@ 2026-07-30  0:16 ` pr-tracker-bot
  0 siblings, 0 replies; 2+ messages in thread
From: pr-tracker-bot @ 2026-07-30  0:16 UTC (permalink / raw)
  To: Masami Hiramatsu (Google)
  Cc: Linus Torvalds, Masami Hiramatsu (Google), Raushan Patel,
	Steven Rostedt, Masami Hiramatsu, linux-kernel

The pull request you sent on Thu, 30 Jul 2026 08:53:31 +0900:

> git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git probes-fixes-v7.2-rc5

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

Thank you!

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-07-30  0:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-29 23:53 [GIT PULL] probes: Fixes for v7.2-rc5 Masami Hiramatsu
2026-07-30  0:16 ` pr-tracker-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox