linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org, linux-trace-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>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	stable@vger.kernel.org
Subject: [PATCH 2/3] trace/ring-buffer: Do not create module or dynamic events in boot mapped buffers
Date: Tue, 17 Dec 2024 12:32:39 -0500	[thread overview]
Message-ID: <20241217173520.483964366@goodmis.org> (raw)
In-Reply-To: 20241217173237.836878448@goodmis.org

From: Steven Rostedt <rostedt@goodmis.org>

When a ring buffer is mapped across boots, an delta is saved between the
addresses of the previous kernel and the current kernel. But this does not
handle module events nor dynamic events.

Simply do not create module or dynamic events to a boot mapped instance.
This will keep them from ever being enabled and therefore not part of the
previous kernel trace.

Cc: stable@vger.kernel.org
Fixes: e645535a954ad ("tracing: Add option to use memmapped memory for trace boot instance")
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 kernel/trace/trace_events.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 77e68efbd43e..d6359318d5c1 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -2984,6 +2984,12 @@ trace_create_new_event(struct trace_event_call *call,
 	if (!event_in_systems(call, tr->system_names))
 		return NULL;
 
+	/* Boot mapped instances cannot use modules or dynamic events */
+	if (tr->flags & TRACE_ARRAY_FL_BOOT) {
+		if ((call->flags & TRACE_EVENT_FL_DYNAMIC) || call->module)
+			return NULL;
+	}
+
 	file = kmem_cache_alloc(file_cachep, GFP_TRACE);
 	if (!file)
 		return ERR_PTR(-ENOMEM);
-- 
2.45.2



  parent reply	other threads:[~2024-12-17 17:34 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-17 17:32 [PATCH 0/3] ring-buffer: Hardening of the persistent buffer Steven Rostedt
2024-12-17 17:32 ` [PATCH 1/3] ring-buffer: Add uname to match criteria for persistent ring buffer Steven Rostedt
2024-12-17 17:46   ` Linus Torvalds
2024-12-17 18:04     ` Steven Rostedt
2024-12-17 18:19       ` Linus Torvalds
2024-12-17 18:24         ` Linus Torvalds
2024-12-17 18:42           ` Steven Rostedt
2024-12-17 19:22           ` Mathieu Desnoyers
2024-12-17 18:33         ` Steven Rostedt
2024-12-17 18:42           ` Linus Torvalds
2024-12-17 19:01             ` Steven Rostedt
2024-12-17 19:38               ` Linus Torvalds
2024-12-17 19:44                 ` Steven Rostedt
2024-12-17 22:24                   ` Linus Torvalds
2024-12-17 22:53                     ` Steven Rostedt
2024-12-17 23:32                       ` Linus Torvalds
2024-12-18  0:02                         ` Linus Torvalds
2024-12-18  0:48                           ` Steven Rostedt
2024-12-18  0:47                         ` Alexei Starovoitov
2024-12-18  1:26                           ` Linus Torvalds
2024-12-18  1:39                             ` Linus Torvalds
2024-12-18  1:53                               ` Alexei Starovoitov
2024-12-17 19:03             ` Linus Torvalds
2024-12-17 19:07               ` Steven Rostedt
2024-12-17 19:14                 ` Steven Rostedt
2024-12-17 18:17     ` Steven Rostedt
2024-12-17 17:32 ` Steven Rostedt [this message]
2024-12-17 17:32 ` [PATCH 3/3] trace/ring-buffer: Do not use TP_printk() formatting for boot mapped buffers 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=20241217173520.483964366@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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;
as well as URLs for NNTP newsgroup(s).