From: Will Deacon <will.deacon@arm.com>
To: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: "eranian@google.com" <eranian@google.com>,
"mingo@elte.hu" <mingo@elte.hu>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: perf NULL pointer dereference on -rc5
Date: Tue, 13 Dec 2011 21:08:38 +0000 [thread overview]
Message-ID: <20111213210838.GA6143@mudshark.cambridge.arm.com> (raw)
In-Reply-To: <1323805735.9082.47.camel@twins>
On Tue, Dec 13, 2011 at 07:48:55PM +0000, Peter Zijlstra wrote:
> On Tue, 2011-12-13 at 15:26 +0000, Will Deacon wrote:
> >
> > Commit 10c6db11 ("perf: Fix loss of notification with multi-event") seems to
> > dereference a NULL event->rb in the wakeup handler during Vince Weaver's perf
> > tests (specifically corner_cases/overflow_requires_mmap).
> >
> > This diff seems to fix the problem, but I'm not sure if it just hides something else:
>
> No that is about right.. not so very good of us to have missed that.
Well, at least we caught it in the end.
> Can I add your SoB to this?
Sure:
Signed-off-by: Will Deacon <will.deacon@arm.com>
Will
> ---
> Subject: perf: Fix ring_buffer_wakeup()
> From: Will Deacon <will.deacon@arm.com>
> Date: Tue Dec 13 20:40:45 CET 2011
>
> Commit 10c6db11 ("perf: Fix loss of notification with multi-event")
> seems to unconditionally dereference event->rb in the wakeup handler,
> this is wrong, there might not be a buffer attached.
>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Link: http://lkml.kernel.org/r/20111213152651.GP20297@mudshark.cambridge.arm.com
> ---
> kernel/events/core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -3360,9 +3360,12 @@ static void ring_buffer_wakeup(struct pe
>
> rcu_read_lock();
> rb = rcu_dereference(event->rb);
> + if (!rb)
> + goto unlock;
> list_for_each_entry_rcu(event, &rb->event_list, rb_entry) {
> wake_up_all(&event->waitq);
> }
> +unlock:
> rcu_read_unlock();
> }
>
>
>
next prev parent reply other threads:[~2011-12-13 21:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-13 15:26 Will Deacon
2011-12-13 19:48 ` Peter Zijlstra
2011-12-13 21:08 ` Will Deacon [this message]
2011-12-13 21:23 ` Stephane Eranian
2011-12-14 10:21 ` [tip:perf/urgent] perf events: Fix ring_buffer_wakeup() brown paperbag bug tip-bot for Will Deacon
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=20111213210838.GA6143@mudshark.cambridge.arm.com \
--to=will.deacon@arm.com \
--cc=a.p.zijlstra@chello.nl \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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
all inboxes | Powered by JetHome®