lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200826132013.GG1059382@kernel.org>
Date:   Wed, 26 Aug 2020 10:20:13 -0300
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Jiri Olsa <jolsa@...hat.com>
Cc:     Ian Rogers <irogers@...gle.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Kajol Jain <kjain@...ux.ibm.com>,
        Andi Kleen <ak@...ux.intel.com>,
        Jin Yao <yao.jin@...ux.intel.com>,
        Kan Liang <kan.liang@...ux.intel.com>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Leo Yan <leo.yan@...aro.org>, linux-kernel@...r.kernel.org,
        Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 2/2] perf parse-events: Avoid an uninitialized read.

Em Wed, Aug 26, 2020 at 01:34:18PM +0200, Jiri Olsa escreveu:
> On Tue, Aug 25, 2020 at 09:29:10PM -0700, Ian Rogers wrote:
> > With a fake_pmu the pmu_info isn't populated by perf_pmu__check_alias.
> > In this case, don't try to copy the uninitialized values to the evsel.
> > 
> > Signed-off-by: Ian Rogers <irogers@...gle.com>
> 
> Acked-by: Jiri Olsa <jolsa@...hat.com>

Thanks, applied.

- Arnaldo
 
> thanks,
> jirka
> 
> > ---
> >  tools/perf/util/parse-events.c | 30 +++++++++++++++++-------------
> >  1 file changed, 17 insertions(+), 13 deletions(-)
> > 
> > diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> > index 9f7260e69113..3d7a48b488ed 100644
> > --- a/tools/perf/util/parse-events.c
> > +++ b/tools/perf/util/parse-events.c
> > @@ -1533,19 +1533,23 @@ int parse_events_add_pmu(struct parse_events_state *parse_state,
> >  	evsel = __add_event(list, &parse_state->idx, &attr, true,
> >  			    get_config_name(head_config), pmu,
> >  			    &config_terms, auto_merge_stats, NULL);
> > -	if (evsel) {
> > -		evsel->unit = info.unit;
> > -		evsel->scale = info.scale;
> > -		evsel->per_pkg = info.per_pkg;
> > -		evsel->snapshot = info.snapshot;
> > -		evsel->metric_expr = info.metric_expr;
> > -		evsel->metric_name = info.metric_name;
> > -		evsel->pmu_name = name ? strdup(name) : NULL;
> > -		evsel->use_uncore_alias = use_uncore_alias;
> > -		evsel->percore = config_term_percore(&evsel->config_terms);
> > -	}
> > -
> > -	return evsel ? 0 : -ENOMEM;
> > +	if (!evsel)
> > +		return -ENOMEM;
> > +
> > +	evsel->pmu_name = name ? strdup(name) : NULL;
> > +	evsel->use_uncore_alias = use_uncore_alias;
> > +	evsel->percore = config_term_percore(&evsel->config_terms);
> > +
> > +	if (parse_state->fake_pmu)
> > +		return 0;
> > +
> > +	evsel->unit = info.unit;
> > +	evsel->scale = info.scale;
> > +	evsel->per_pkg = info.per_pkg;
> > +	evsel->snapshot = info.snapshot;
> > +	evsel->metric_expr = info.metric_expr;
> > +	evsel->metric_name = info.metric_name;
> > +	return 0;
> >  }
> >  
> >  int parse_events_multi_pmu_add(struct parse_events_state *parse_state,
> > -- 
> > 2.28.0.297.g1956fa8f8d-goog
> > 
> 

-- 

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ