linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikita Yushchenko <nikita.yushchenko@virtuozzo.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org, kernel@openvz.org
Subject: Re: [PATCH] tracing: fix va_list breakage in trace_check_vprintf()
Date: Thu, 18 Nov 2021 07:57:33 +0300	[thread overview]
Message-ID: <ae2254dd-dcc8-3375-e8d6-efb73e280574@virtuozzo.com> (raw)
In-Reply-To: <20211117183827.4989cfab@gandalf.local.home>

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

  parent reply	other threads:[~2021-11-18  4:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-17 18:37 [PATCH] tracing: fix va_list breakage in trace_check_vprintf() Nikita Yushchenko
2021-11-17 23:38 ` Steven Rostedt
2021-11-17 23:41   ` Steven Rostedt
2021-11-18  4:57   ` Nikita Yushchenko [this message]
2021-11-18  5:44     ` [PATCH] trace: don't use out-of-sync va_list in event printing Nikita Yushchenko
2021-11-18 14:30     ` [PATCH] tracing: fix va_list breakage in trace_check_vprintf() Steven Rostedt
2021-11-18 14:54       ` Nikita Yushchenko

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=ae2254dd-dcc8-3375-e8d6-efb73e280574@virtuozzo.com \
    --to=nikita.yushchenko@virtuozzo.com \
    --cc=kernel@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.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).