Re: [PATCH] perf record: Fix segmentation fault in record__read_lost_samples()

From: Arnaldo Carvalho de Melo
Date: Mon Sep 26 2022 - 10:42:03 EST


Em Sun, Sep 25, 2022 at 09:12:37AM +0800, Leo Yan escreveu:
> Hi Namhyung,
>
> On Sat, Sep 24, 2022 at 09:52:09AM -0700, Namhyung Kim wrote:
>
> [...]
>
> > > In the unprivileged mode perf fails to open PMU event, the function
> > > record__open() returns error and "session->evlist" is NULL; this leads
> > > to segmentation fault when iterates "session->evlist" in the function
> > > record__read_lost_samples().
> > >
> > > This patch checks "session->evlist" in record__read_lost_samples(), if
> > > "session->evlist" is NULL then the function directly bails out to avoid
> > > segmentation fault.
> > >
> > > Fixes: a49aa8a54e86 ("perf record: Read and inject LOST_SAMPLES events")
> > > Signed-off-by: Leo Yan <leo.yan@xxxxxxxxxx>
> >
> > Thanks for the fix and sorry for the inconvenience.
> > Actually I sent the same fix a few weeks ago.
> >
> > https://lore.kernel.org/r/20220909235024.278281-1-namhyung@xxxxxxxxxx
>
> Thanks a lot for the info and fix. The patch in above link looks good
> to me! Please ignore this one.

Took that as an Acked-by: Leo, thanks!

- Arnaldo