From: Jiri Olsa <jolsa@redhat.com>
To: Stephane Eranian <eranian@google.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Arnaldo Carvalho de Melo <acme@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
mingo@elte.hu
Subject: Re: [PATCH] perf ordered_events: fix crash in free_dup_event()
Date: Tue, 7 Aug 2018 10:50:10 +0200 [thread overview]
Message-ID: <20180807085010.GC7716@krava> (raw)
In-Reply-To: <CABPqkBSyf0WMKmZAFGSyBvX=jn1zifbMPztt_053hvvDh6UsHw@mail.gmail.com>
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@redhat.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@krava 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
next prev parent reply other threads:[~2018-08-07 8:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-07 1:23 [PATCH] perf ordered_events: fix crash in free_dup_event() Stephane Eranian
2018-08-07 7:20 ` Jiri Olsa
2018-08-07 8:16 ` Stephane Eranian
2018-08-07 8:50 ` Jiri Olsa [this message]
2018-08-07 19:11 ` Stephane Eranian
2018-08-08 8:23 ` Jiri Olsa
2018-08-08 21:47 ` Stephane Eranian
2018-08-09 7:39 ` Jiri Olsa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180807085010.GC7716@krava \
--to=jolsa@redhat.com \
--cc=acme@redhat.com \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox