[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180807085010.GC7716@krava>
Date: Tue, 7 Aug 2018 10:50:10 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Stephane Eranian <eranian@...gle.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Peter Zijlstra <peterz@...radead.org>, mingo@...e.hu
Subject: Re: [PATCH] perf ordered_events: fix crash in free_dup_event()
On Tue, Aug 07, 2018 at 01:16:22AM -0700, Stephane Eranian wrote:
> On Tue, Aug 7, 2018 at 12:20 AM Jiri Olsa <jolsa@...hat.com> wrote:
> >
> > On Mon, Aug 06, 2018 at 06:23:35PM -0700, Stephane Eranian wrote:
> > > Depending on memory allocations, it was possible to get a SEGFAULT in
> > > free_dup_event() because the event pointer was bogus:
> > >
> > > perf[1354]: segfault at ffffffff00000006 ip 00000000004b7fc7
> >
> > is there any reproducer?
> >
> The cmdline is simple:
> $ perf record -e cycles:pp -o - -a sleep 1 | perf inject -b -i - >/dev/null
> I was using v4.13 for my tests and it may be sensitive to compiler.
> Was using LLVM.
I can't make it fail even when I compile with clang 'make CC=clang'
[jolsa@...va perf]$ clang --version
clang version 6.0.1 (tags/RELEASE_601/final)
I'm on v4.17, but I dont think kernel version is related to this issue
>
> It may be a compiler related issue. You do not allocate the whole struct.
> If the compiler was to do a memcpy() behind your back, you'd be in
> troubles.
>
> Adding extra padding before *event was also avoiding the problem.
> struct ordered_event {
> u64 timestamp;
> u64 file_offset;
> char pad[32]; <----- extra padding for debugging
> union perf_event *event;
> struct list_head list;
> };
might be some issue in the struct ordered_event allocation,
which is little convoluted
jirka
Powered by blists - more mailing lists