[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPhsuW7AktPKcw6KG7kRm-5Jm_TnhdPczT_G8fP3c49jT0DqWQ@mail.gmail.com>
Date: Wed, 16 Jan 2019 23:33:55 -0800
From: Song Liu <liu.song.a23@...il.com>
To: Jiri Olsa <jolsa@...hat.com>
Cc: open list <linux-kernel@...r.kernel.org>,
Jiri Olsa <jolsa@...nel.org>, acme@...nel.org
Subject: Re: perf segfault in in ordered_events__free()
On Wed, Jan 16, 2019 at 1:53 PM Song Liu <liu.song.a23@...il.com> wrote:
>
> Thanks Jiri!
>
> On Wed, Jan 16, 2019 at 1:34 PM Jiri Olsa <jolsa@...hat.com> wrote:
> >
> > On Wed, Jan 16, 2019 at 10:57:49AM -0800, Song Liu wrote:
> > > Hi,
> > >
> > > We are debugging a segfault of perf in ordered_events__free().
> >
> > hi,
> > any backtrace or info on how to reproduce it?
>
> Here is the backtrace:
>
> #0 0x0000000000500055 in ordered_events(float, long double,...)(...) ()
> #1 0x0000000000500196 in ordered_events.reinit ()
> #2 0x00000000004fe413 in perf_session.process_events ()
> #3 0x0000000000440431 in cmd_record ()
> #4 0x00000000004a439f in run_builtin ()
> #5 0x000000000042b3e5 in main ()"
>
> >
> > > Disassemble shows the segfault was caused by oe->buff == NULL
> > > in the following line:
> > >
> > > /*
> > > * Current buffer might not have all the events allocated
> > > * yet, we need to free only allocated ones ...
> > > */
> > > list_del(&oe->buffer->list);
> > >
> > > After poking around the code, I suspect it is caused by the following
> > > condition in alloc_event():
> > >
> > > } else if (oe->buffer) {
> > > new = &oe->buffer->event[oe->buffer_idx];
> > > if (++oe->buffer_idx == MAX_SAMPLE_BUFFER)
> > > oe->buffer = NULL;
> >
> >
> > argh.. yea, we need to check oe->buffer in ordered_events__free
> >
> > would attached change fix it for you?
>
> Let me try roll a fixed version to confirm.
Yes, the patch fixes this segfault. Please CC me on the official patch to
back port the official version.
Thanks,
Song
Powered by blists - more mailing lists