[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200513133128.GB5583@kernel.org>
Date: Wed, 13 May 2020 10:31:28 -0300
From: Arnaldo Carvalho de Melo <arnaldo.melo@...il.com>
To: Ian Rogers <irogers@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Leo Yan <leo.yan@...aro.org>,
Jin Yao <yao.jin@...ux.intel.com>,
linux-kernel@...r.kernel.org, Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH] perf parse-events: Avoid free on non malloc-ed memory
Em Tue, May 12, 2020 at 04:52:02PM -0700, Ian Rogers escreveu:
> Caught by libfuzzer, there is a segfault with:
> $ perf stat -e i/bs,tsc,L2/o sleep 1
> As a config_term is added that isn't a string.
Yeah, I've just applied a similar patch after looking at your private
report, added the same fixes, used your reproducer,
Thanks,
- Arnaldo
> Fixes: e8dfb81838b1 (perf parse-events: Fix memory leaks found on parse_events)
> Signed-off-by: Ian Rogers <irogers@...gle.com>
> ---
> tools/perf/util/parse-events.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> index e9464b04f149..e37a6a3e6217 100644
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -1480,7 +1480,8 @@ int parse_events_add_pmu(struct parse_events_state *parse_state,
>
> list_for_each_entry_safe(pos, tmp, &config_terms, list) {
> list_del_init(&pos->list);
> - zfree(&pos->val.str);
> + if (pos->free_str)
> + zfree(&pos->val.str);
> free(pos);
> }
> return -EINVAL;
> --
> 2.26.2.645.ge9eca65c58-goog
>
--
- Arnaldo
Powered by blists - more mailing lists