[<prev] [next>] [day] [month] [year] [list]
Message-ID: <tip-bc27lshz823hxl8n9nkelcgh@git.kernel.org>
Date: Tue, 22 Aug 2017 03:24:39 -0700
From: tip-bot for Arnaldo Carvalho de Melo <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: hpa@...or.com, adrian.hunter@...el.com, jolsa@...nel.org,
ak@...ux.intel.com, tglx@...utronix.de, acme@...hat.com,
wangnan0@...wei.com, dsahern@...il.com,
linux-kernel@...r.kernel.org, namhyung@...nel.org, mingo@...nel.org
Subject: [tip:perf/core] perf events parse: Use just one parse events state
struct
Commit-ID: d17d0878f456c8227345b6c76b918ec068fa0abd
Gitweb: http://git.kernel.org/tip/d17d0878f456c8227345b6c76b918ec068fa0abd
Author: Arnaldo Carvalho de Melo <acme@...hat.com>
AuthorDate: Thu, 17 Aug 2017 14:22:50 -0300
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Thu, 17 Aug 2017 16:39:15 -0300
perf events parse: Use just one parse events state struct
Andi reported problems when parse errors were detected with vendor
events (json), because in the yyparse/parse_events_parse function we
dereferenced the _data parameter to two different structs, with
different layouts, which ended up making parse_events_evlist->error to
point to random stack addresses.
Fix it by making _data to always be struct parse_events_state, changing
the only place where 'struct parse_events_term' was used in
parse_events.y.
Reported-by: Andi Kleen <ak@...ux.intel.com>
Cc: Adrian Hunter <adrian.hunter@...el.com>
Cc: David Ahern <dsahern@...il.com>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Wang Nan <wangnan0@...wei.com>
Link: http://lkml.kernel.org/n/tip-bc27lshz823hxl8n9nkelcgh@git.kernel.org
Fixes: 90e2b22dee90 ("perf/tool: Add support to reuse event grammar to parse out terms")
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/parse-events.c | 2 +-
tools/perf/util/parse-events.h | 5 +----
tools/perf/util/parse-events.y | 2 +-
3 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 272eab7..d4fcf04 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1656,7 +1656,7 @@ static int parse_events__scanner(const char *str, void *data, int start_token)
*/
int parse_events_terms(struct list_head *terms, const char *str)
{
- struct parse_events_terms data = {
+ struct parse_events_state data = {
.terms = NULL,
};
int ret;
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index 8fff842..2a36179 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -114,10 +114,7 @@ struct parse_events_state {
int nr_groups;
struct parse_events_error *error;
struct perf_evlist *evlist;
-};
-
-struct parse_events_terms {
- struct list_head *terms;
+ struct list_head *terms;
};
void parse_events__shrink_config_terms(void);
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index 403a221..4b37546 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -488,7 +488,7 @@ opt_event_config:
start_terms: event_config
{
- struct parse_events_terms *data = _data;
+ struct parse_events_state *data = _data;
data->terms = $1;
}
Powered by blists - more mailing lists