Re: [PATCH 2/2] perf, tools: Avoid segfault on alias parse error

2017-08-22 Thread Jiri Olsa
On Thu, Aug 17, 2017 at 02:22:32PM -0300, Arnaldo Carvalho de Melo wrote: > Em Thu, Aug 17, 2017 at 10:04:53AM -0700, Andi Kleen escreveu: > > > So it will _not_ set to null a member that it doesn't have, i.e. the > > > minimal fix is to just have the hunks below, making sure that the error > > > f

Re: [PATCH 2/2] perf, tools: Avoid segfault on alias parse error

2017-08-17 Thread Arnaldo Carvalho de Melo
Em Thu, Aug 17, 2017 at 10:04:53AM -0700, Andi Kleen escreveu: > > So it will _not_ set to null a member that it doesn't have, i.e. the > > minimal fix is to just have the hunks below, making sure that the error > > field is present in both structs. No need to set > > parse_event_terms->error to an

Re: [PATCH 2/2] perf, tools: Avoid segfault on alias parse error

2017-08-17 Thread Andi Kleen
> So it will _not_ set to null a member that it doesn't have, i.e. the > minimal fix is to just have the hunks below, making sure that the error > field is present in both structs. No need to set > parse_event_terms->error to anything, it will be set to null since other > fields are set to somethin

Re: [PATCH 2/2] perf, tools: Avoid segfault on alias parse error

2017-08-17 Thread Andi Kleen
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 v

Re: [PATCH 2/2] perf, tools: Avoid segfault on alias parse error

2017-08-17 Thread Arnaldo Carvalho de Melo
Em Thu, Aug 17, 2017 at 12:28:16PM -0300, Arnaldo Carvalho de Melo escreveu: > Em Wed, Aug 16, 2017 at 03:02:01PM -0700, Andi Kleen escreveu: > > +++ b/tools/perf/util/parse-events.h > > @@ -108,15 +108,17 @@ struct parse_events_error { > > char *help; /* optional help string */ > > }; > >

Re: [PATCH 2/2] perf, tools: Avoid segfault on alias parse error

2017-08-17 Thread Arnaldo Carvalho de Melo
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

Re: [PATCH 2/2] perf, tools: Avoid segfault on alias parse error

2017-08-17 Thread Andi Kleen
> Humm, but don't we have that checked? At least not in the case of the segfault below. -Andi > > void parse_events_evlist_error(struct parse_events_evlist *data, >int idx, const char *str) > { > struct parse_events_error *err = data->error; > >

Re: [PATCH 2/2] perf, tools: Avoid segfault on alias parse error

2017-08-17 Thread Arnaldo Carvalho de Melo
Em Wed, Aug 16, 2017 at 03:02:01PM -0700, Andi Kleen escreveu: > From: Andi Kleen > > When there is a parse error on adding an alias the parser > segfaults. It thinks data is a parse_events_evlist and tries > to reference the error member. But it's really a parse_events_terms > for this call path

[PATCH 2/2] perf, tools: Avoid segfault on alias parse error

2017-08-16 Thread Andi Kleen
From: Andi Kleen When there is a parse error on adding an alias the parser segfaults. It thinks data is a parse_events_evlist and tries to reference the error member. But it's really a parse_events_terms for this call path through parse_events_terms. Add the error member at the same location in