Re: [PATCH] perf test: Perf test 67 dumps core on s390

From: Arnaldo Carvalho de Melo
Date: Wed Aug 26 2020 - 07:46:17 EST


Em Tue, Aug 25, 2020 at 02:04:30PM -0700, Ian Rogers escreveu:
> On Tue, Aug 25, 2020 at 12:12 AM Thomas Richter <tmricht@xxxxxxxxxxxxx> wrote:
> >
> > Linux 5.9 introduced perf test case "Parse and process metrics" and
> > on s390 this test case always dumps core:

<SNIP>

> > Signed-off-by: Thomas Richter <tmricht@xxxxxxxxxxxxx>
> > Reviewed-by: Sumanth Korikkar <sumanthk@xxxxxxxxxxxxx>
>
> Acked-by: Ian Rogers <irogers@xxxxxxxxxx>

I'll add your comments and...

> This also shows up with address sanitizer on all architectures
> (perhaps change the patch title) and perhaps add a "Fixes: <commit>"
> tag.
> =================================================================
> ==4718==ERROR: AddressSanitizer: global-buffer-overflow on address
> 0x55c93b4d59e8 at pc 0x55c93a1541e2 bp 0x7ffd24327c60 sp
> 0x7ffd24327c58
> READ of size 8 at 0x55c93b4d59e8 thread T0
> #0 0x55c93a1541e1 in find_metric tools/perf/util/metricgroup.c:764:2
> > +++ b/tools/perf/tests/parse-metric.c
> > @@ -70,6 +70,11 @@ static struct pmu_event pme_test[] = {
> > {
> > .metric_expr = "1/m3",
> > .metric_name = "M3",
> > +},
> > +{
> > + .metric_expr = NULL,
> > + .metric_name = NULL,
> > + .metric_group = NULL

No need to set all three to NULL, just one is enough and then the
compiler will zero out all the rest.

- Arnaldo