lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240125222818.7425-2-ricardo@marliere.net>
Date: Thu, 25 Jan 2024 19:28:16 -0300
From: "Ricardo B. Marliere" <ricardo@...liere.net>
To: Steven Rostedt <rostedt@...dmis.org>,
	Masami Hiramatsu <mhiramat@...nel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc: "Ricardo B. Marliere" <ricardo@...liere.net>,
	linux-kernel@...r.kernel.org,
	linux-trace-kernel@...r.kernel.org
Subject: [PATCH v3 1/3] tracing: initialize trace_seq buffers

In order to extend trace_seq into being dynamic, the struct trace_seq
will no longer be valid if simply set to zero. Call trace_seq_init() for
all trace_seq when they are first created.

Suggested-by: Steven Rostedt <rostedt@...dmis.org>
Signed-off-by: Ricardo B. Marliere <ricardo@...liere.net>
---
 kernel/trace/trace.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 46dbe22121e9..9eddf8168df2 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -4889,6 +4889,9 @@ __tracing_open(struct inode *inode, struct file *file, bool snapshot)
 
 	mutex_unlock(&trace_types_lock);
 
+	trace_seq_init(&iter->seq);
+	trace_seq_init(&iter->tmp_seq);
+
 	return iter;
 
  fail:
@@ -6770,6 +6773,7 @@ static int tracing_open_pipe(struct inode *inode, struct file *filp)
 	}
 
 	trace_seq_init(&iter->seq);
+	trace_seq_init(&iter->tmp_seq);
 	iter->trace = tr->current_trace;
 
 	if (!alloc_cpumask_var(&iter->started, GFP_KERNEL)) {
@@ -6947,6 +6951,7 @@ tracing_read_pipe(struct file *filp, char __user *ubuf,
 	trace_iterator_reset(iter);
 	cpumask_clear(iter->started);
 	trace_seq_init(&iter->seq);
+	trace_seq_init(&iter->tmp_seq);
 
 	trace_event_read_lock();
 	trace_access_lock(iter->cpu_file);
@@ -8277,6 +8282,9 @@ static int tracing_buffers_open(struct inode *inode, struct file *filp)
 	if (ret < 0)
 		trace_array_put(tr);
 
+	trace_seq_init(&info->iter.seq);
+	trace_seq_init(&info->iter.tmp_seq);
+
 	return ret;
 }
 
@@ -10300,6 +10308,9 @@ void trace_init_global_iter(struct trace_iterator *iter)
 	iter->temp_size = STATIC_TEMP_BUF_SIZE;
 	iter->fmt = static_fmt_buf;
 	iter->fmt_size = STATIC_FMT_BUF_SIZE;
+
+	trace_seq_init(&iter->seq);
+	trace_seq_init(&iter->tmp_seq);
 }
 
 void ftrace_dump(enum ftrace_dump_mode oops_dump_mode)
@@ -10712,6 +10723,9 @@ void __init early_trace_init(void)
 			tracepoint_printk = 0;
 		else
 			static_key_enable(&tracepoint_printk_key.key);
+
+		trace_seq_init(&tracepoint_print_iter->seq);
+		trace_seq_init(&tracepoint_print_iter->tmp_seq);
 	}
 	tracer_alloc_buffers();
 
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ