[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241215085109.546a9b8c@gandalf.local.home>
Date: Sun, 15 Dec 2024 08:51:09 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: LKML <linux-kernel@...r.kernel.org>, Masami Hiramatsu
<mhiramat@...nel.org>, Mark Rutland <mark.rutland@....com>, Mathieu
Desnoyers <mathieu.desnoyers@...icios.com>, Al Viro
<viro@...iv.linux.org.uk>, Michal Simek <monstr@...str.eu>
Subject: Re: [GIT PULL] ftrace: Fixes for v6.13
On Sun, 15 Dec 2024 05:05:17 -0500
Steven Rostedt <rostedt@...dmis.org> wrote:
> Honestly, I did not like this code when I wrote it, but I have no idea how
> to stop the "%s" bug from happening before it gets out to production. This
> worked. Do you have any suggestions for alternatives?
My mind wouldn't stop thinking about this all night, and I think I found an
alternative.
The test_event_printk() catches everything but the "%s" issue, only because
we allow events to print to static strings and not have to copy them into
the ring buffer. But that function also has access to the event fields. It
can figure out which field is being printed by "%s", and flag it. Then on
output, it can check that the field is going to be printed before the
vsnprintf() is called on the TP_printk() format.
If it is a bad field, it can inject into the trace that the field is bad,
not print the event at all, and trigger a WARN_ON_ONCE().
Hmm,
-- Steve
Powered by blists - more mailing lists