From: Steven Rostedt <rostedt@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Andrew Morton <akpm@linux-foundation.org>,
Vincent Donnefort <vdonnefort@google.com>
Subject: [for-linus][PATCH 07/12] tracing: Fix to avoid creating trace instances with duplicate names
Date: Sat, 05 Sep 2026 16:08:34 -0400 [thread overview]
Message-ID: <20260905200915.865970617@kernel.org> (raw)
In-Reply-To: <20260905200827.773347757@kernel.org>
From: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Since commit e645535a954a ("tracing: Add option to use memmapped
memory for trace boot instance") changed trace_array_get_by_name() to
trace_array_create_systems(), enable_instances() does not reuse the
same name instance. Therefore, if an administrator mistakenly specifies
multiple `trace_instance=` options with duplicate names, all are
created but only the first is accessible via tracefs.
Check whether an instance with the same name already exists before
creating a new one, and reject duplicates with a warning.
Link: https://patch.msgid.link/178847790399.283263.5313150997200138426.stgit@devnote2
Fixes: e645535a954a ("tracing: Add option to use memmapped memory for trace boot instance")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 722d0ba2d233..138e983c3c2f 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -9710,6 +9710,11 @@ __init static void enable_instances(void)
if (flag_delim)
*flag_delim++ = '\0';
+ if (trace_array_find(name)) {
+ pr_warn("Tracing: Instance %s already exists\n", name);
+ continue;
+ }
+
if (backup) {
if (backup_instance_area(backup, &addr, &size) < 0)
continue;
--
2.53.0
next prev parent reply other threads:[~2026-09-06 1:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-05 20:08 [for-linus][PATCH 00/12] tracing: Fixes for v7.3 Steven Rostedt
2026-09-05 20:08 ` [for-linus][PATCH 01/12] tracing: Have show_event_filters/triggers files take trace array ref Steven Rostedt
2026-09-05 20:08 ` [for-linus][PATCH 02/12] ftrace: Take trace_array reference before accessing its ftrace_ops Steven Rostedt
2026-09-05 20:08 ` [for-linus][PATCH 03/12] ftrace: Synchronize the initialization of ftrace_ops Steven Rostedt
2026-09-05 20:08 ` [for-linus][PATCH 04/12] tracing: Take trace_array reference when opening options file Steven Rostedt
2026-09-05 20:08 ` [for-linus][PATCH 05/12] ring-buffer: Allow splice reads on static buffers Steven Rostedt
2026-09-05 20:08 ` [for-linus][PATCH 06/12] ring-buffer: Add checking nr_subbufs to persistent ring buffer validation Steven Rostedt
2026-09-05 20:08 ` Steven Rostedt [this message]
2026-09-05 20:08 ` [for-linus][PATCH 08/12] tracing: Fix subbuf resize races with trace_pipe_raw readers Steven Rostedt
2026-09-05 20:08 ` [for-linus][PATCH 09/12] ring-buffer: Cap static ring buffer nr_pages Steven Rostedt
2026-09-05 20:08 ` [for-linus][PATCH 10/12] ring-buffer: Prevent truncation of nr_pages / nr_subbufs Steven Rostedt
2026-09-05 20:08 ` [for-linus][PATCH 11/12] tracing: Fix comment in tracing_buffers_splice_read() Steven Rostedt
2026-09-05 20:08 ` [for-linus][PATCH 12/12] ring-buffer: Use a macro for static buffer bits Steven Rostedt
2026-09-06 1:45 [for-linus][PATCH 00/12] tracing: Fixes for v7.3 Steven Rostedt
2026-09-06 1:45 ` [for-linus][PATCH 07/12] tracing: Fix to avoid creating trace instances with duplicate names Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260905200915.865970617@kernel.org \
--to=rostedt@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=vdonnefort@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®