All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andi Kleen <ak@linux.intel.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Andi Kleen <andi@firstfloor.org>,
	jolsa@kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] perf, tools: Avoid segfault on alias parse error
Date: Thu, 17 Aug 2017 10:02:49 -0700	[thread overview]
Message-ID: <20170817170249.GK28715@tassilo.jf.intel.com> (raw)
In-Reply-To: <20170817162539.GD10891@kernel.org>

On Thu, Aug 17, 2017 at 01:25:39PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Thu, Aug 17, 2017 at 08:34:22AM -0700, Andi Kleen escreveu:
> > > Humm, but don't we have that checked?
> > 
> > At least not in the case of the segfault below.
> 
> Again:
> 
> tools/perf/util/parse-events.c
> 
> 2523 void parse_events_evlist_error(struct parse_events_evlist *data,
> 2524                                int idx, const char *str)
> 2525 {
> 2526         struct parse_events_error *err = data->error;
> 2527 
> 2528         if (!err)
> 2529                 return;
> 2530         err->idx = idx;
> 2531         err->str = strdup(str);
> 2532         WARN_ONCE(!err->str, "WARNING: failed to allocate error string");
> 2533 }
> 
> data->error _is_ being checked for NULL, and the hunk you added would

In the crash, data->error is not NULL, it's random stack contents
because the data types for the data pointer do not match
(parse_events_evlist vs parse_events_terms)

-Andi

  reply	other threads:[~2017-08-17 17:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-16 22:01 Two minor perf patches preparing for Skylake server events Andi Kleen
2017-08-16 22:02 ` [PATCH 1/2] perf, tools, json: Support FCMask and PortMask Andi Kleen
2017-08-17 15:20   ` Arnaldo Carvalho de Melo
2017-08-22 10:23   ` [tip:perf/core] perf jevents: " tip-bot for Andi Kleen
2017-08-16 22:02 ` [PATCH 2/2] perf, tools: Avoid segfault on alias parse error Andi Kleen
2017-08-17 15:28   ` Arnaldo Carvalho de Melo
2017-08-17 15:34     ` Andi Kleen
2017-08-17 16:25       ` Arnaldo Carvalho de Melo
2017-08-17 17:02         ` Andi Kleen [this message]
2017-08-17 16:42     ` Arnaldo Carvalho de Melo
2017-08-17 17:04       ` Andi Kleen
2017-08-17 17:22         ` Arnaldo Carvalho de Melo
2017-08-22  7:23           ` Jiri Olsa

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=20170817170249.GK28715@tassilo.jf.intel.com \
    --to=ak@linux.intel.com \
    --cc=acme@kernel.org \
    --cc=andi@firstfloor.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.