linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: linux-trace-devel@vger.kernel.org, Ian Rogers <irogers@google.com>
Subject: Re: [PATCH] libtraceevent: Reset right arg when copying TEP_PRINT_OP
Date: Wed, 8 Jun 2022 11:17:33 -0400	[thread overview]
Message-ID: <20220608111733.283dce42@gandalf.local.home> (raw)
In-Reply-To: <20220606195859.771436-1-namhyung@kernel.org>

On Mon,  6 Jun 2022 12:58:59 -0700
Namhyung Kim <namhyung@kernel.org> wrote:

> When processing a TEP_PRINT_OP type arg, the original arg was copied
> to the left arg and resets itself.  But it misses the reset the right
> in some places and it could result in a use-after-free.
> 
> A fuzzer test found out that something like below can trigger it
> 
>   print fmt: "", c * ((3 * t)[
> 
> At the time it sees the "[" token, the arg would have like
> 
>   arg->type = TEP_PRINT_OP
>   arg->op.op = "*"
>   arg->op.left = (arg of 3)
>   arg->op.right = (arg of t)
> 
> and it creates a new left and copies the contents.  Also it resets
> itself with
> 
>   arg->op.op = "["
>   arg->op.left = (new left)
> 
> But it can have the same arg->op.right if the process_array() fails
> before setting it.  It should reset the right pointer as it passed the
> ownership before.  The same thing can happend for process_cond().
> 
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  src/event-parse.c | 2 ++
>  1 file changed, 2 insertions(+)

Applied. Thanks Namhyung!

-- Steve

      reply	other threads:[~2022-06-08 15:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-06 19:58 [PATCH] libtraceevent: Reset right arg when copying TEP_PRINT_OP Namhyung Kim
2022-06-08 15:17 ` Steven Rostedt [this message]

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=20220608111733.283dce42@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=irogers@google.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=namhyung@kernel.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).