[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <lsq.1511315892.636183347@decadent.org.uk>
Date: Wed, 22 Nov 2017 01:58:12 +0000
From: Ben Hutchings <ben@...adent.org.uk>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
CC: akpm@...ux-foundation.org, "Jiri Olsa" <jolsa@...nel.org>,
"Namhyung Kim" <namhyung@...nel.org>,
"Arnaldo Carvalho de Melo" <acme@...hat.com>,
"Wang Nan" <wangnan0@...wei.com>,
"Andi Kleen" <ak@...ux.intel.com>,
"Adrian Hunter" <adrian.hunter@...el.com>,
"David Ahern" <dsahern@...il.com>
Subject: [PATCH 3.16 036/133] perf events parse: Use just one parse events
state struct
3.16.51-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnaldo Carvalho de Melo <acme@...hat.com>
commit d17d0878f456c8227345b6c76b918ec068fa0abd upstream.
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>
[bwh: Backported to 3.16: adjust context]
Signed-off-by: Ben Hutchings <ben@...adent.org.uk>
---
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(-)
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -908,7 +908,7 @@ static int parse_events__scanner(const c
*/
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;
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -65,10 +65,7 @@ struct parse_events_state {
struct list_head list;
int idx;
int nr_groups;
-};
-
-struct parse_events_terms {
- struct list_head *terms;
+ struct list_head *terms;
};
int parse_events__is_hardcoded_term(struct parse_events_term *term);
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -346,7 +346,7 @@ PE_RAW
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