Thread (10 messages) 10 messages, 2 authors, 2024-02-27

Re: Kernel WARNING at lib/vsprintf.c:2721 while running ftrace kernel selftests

From: Steven Rostedt <rostedt@goodmis.org>
Date: 2024-02-27 16:23:10
Subsystem: the rest, tracing · Maintainers: Linus Torvalds, Steven Rostedt, Masami Hiramatsu

On Tue, 27 Feb 2024 21:38:57 +0530
Sachin Sant [off-list ref] wrote:
This warning was not triggered.
Interesting.
I have attached .config
This is what I was looking for:
# CONFIG_PPC_4K_PAGES is not set
CONFIG_PPC_64K_PAGES=y
CONFIG_PAGE_SIZE_64KB=y
CONFIG_PPC_PAGE_SHIFT=16
So the pages are 64K in size. I wonder if this is causing an issue.

Can you apply this, and see if it triggers and if it does, print the line
that has the max size?

-- Steve
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index 3e7fa44dc2b2..43e270bf8d78 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -1589,6 +1589,9 @@ static enum print_line_t trace_print_print(struct trace_iterator *iter,
 	struct trace_seq *s = &iter->seq;
 	int max = iter->ent_size - offsetof(struct print_entry, buf);
 
+	if (WARN_ONCE(max < 0 || max > 2000, "MAX OUT OF RANGE %d", max))
+		return TRACE_TYPE_UNHANDLED;
+
 	trace_assign_type(field, iter->ent);
 
 	seq_print_ip_sym(s, field->ip, flags);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help