lkml.org 
[lkml]   [2021]   [Nov]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] tracing: fix va_list breakage in trace_check_vprintf()
From
Date
Hi

> The real fix is:
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index f9139dc1262c..7aa5ea5ca912 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -3654,6 +3654,10 @@ static bool trace_safe_str(struct trace_iterator *iter, const char *str)
> struct trace_event *trace_event;
> struct trace_event_call *event;
>
> + /* if seq is full, then we can't test it */
> + if (iter->seq->full)
> + return true;
> +

What I don't like here is - trace_check_vprintf() will still extract wrong positional arguments, and use
the result as part of it's logic.

Although with your change such use becomes a no-op, this is unintuitive and can turn easily into real
problems with future changes.

And, the above comment is inexact... why we can't test? We can, testing code does no depend on
iter->seq. What we can't is - reliably extract str to test.

If testing seq->full condition is preferred over forcibly consuming args from va_list, then such a test
shall be done before trace_check_vprintf() tries to use va_arg(). Will submit a patch doing that.

Nikita

\
 
 \ /
  Last update: 2021-11-18 05:58    [W:0.431 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site