Re: [PATCH] perf jevents: Fix suspicious code in fixregex()

From: Arnaldo Carvalho de Melo
Date: Thu Sep 03 2020 - 22:10:04 EST


Em Fri, Sep 04, 2020 at 10:38:35AM +0900, Namhyung Kim escreveu:
> On Fri, Sep 4, 2020 at 3:41 AM Arnaldo Carvalho de Melo <acme@xxxxxxxxxx> wrote:
> > Em Thu, Sep 03, 2020 at 10:47:39AM -0700, Ian Rogers escreveu:
> > > On Thu, Sep 3, 2020 at 8:25 AM Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
> > > > The new string should have enough space for the original string and
> > > > the back slashes IMHO.
> > > > Cc: John Garry <john.garry@xxxxxxxxxx>
> > > > Cc: Kajol Jain <kjain@xxxxxxxxxxxxx>
> > > > Cc: Ian Rogers <irogers@xxxxxxxxxx>
> > > > Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx>
> > > Reviewed-by: Ian Rogers <irogers@xxxxxxxxxx>
> > > Definitely looks like the right fix. I'm surprised this hasn't shown
> > > up in sanitizer testing.

> I guess the code didn't run on most arch (including x86) since
> they don't have backslashes.

> > Yeap, good catch! Namyung you forgot to add the Fixes tag + Cc the patch
> > author that introduced that bug, I did it:

> > Cc: William Cohen <wcohen@xxxxxxxxxx>
> > Fixes: fbc2844e84038ce3 ("perf vendor events: Use more flexible pattern matching for CPU identification for mapfile.csv"

> > Please consider doing it next time :-)

> Oh, right! Will do it later..

Thanks!

- Arnaldo