From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755383AbaEEROn (ORCPT ); Mon, 5 May 2014 13:14:43 -0400 Received: from bombadil.infradead.org ([198.137.202.9]:41809 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754792AbaEEROj convert rfc822-to-8bit (ORCPT ); Mon, 5 May 2014 13:14:39 -0400 Date: Mon, 5 May 2014 19:14:28 +0200 From: Peter Zijlstra To: Vince Weaver Cc: Thomas Gleixner , Ingo Molnar , linux-kernel@vger.kernel.org, Steven Rostedt Subject: Re: [perf] more perf_fuzzer memory corruption Message-ID: <20140505171428.GU26782@laptop.programming.kicks-ass.net> References: <20140502172731.GK30445@twins.programming.kicks-ass.net> <20140505093124.GN17778@laptop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 05, 2014 at 01:10:55PM -0400, Vince Weaver wrote: > On Mon, 5 May 2014, Vince Weaver wrote: > > > (Although often things like to crash the instant my tested-by e-mails > > clear the lkml list.) > > This did turn up on the core2 machine. I had been seeing this problem > earlier but was hoping it was part of the memory corruption issue: > > [ 4918.921921] BUG: unable to handle kernel NULL pointer dereference at 0000000000000010 > [ 4918.925692] IP: [] mutex_lock+0x19/0x37 > [ 4918.925692] Call Trace: > [ 4918.925692] [] perf_event_init_context+0x7c/0x1c8 > [ 4918.925692] [] perf_event_init_task+0x69/0x6d > [ 4918.925692] [] copy_process+0x5cc/0x163b > [ 4918.925692] [] do_fork+0x74/0x1dc > [ 4918.925692] [] SyS_clone+0x16/0x18 > [ 4918.925692] [] stub_clone+0x69/0x90 Cute.. does the below cure? --- Subject: perf: Fix perf_event_init_context() From: Peter Zijlstra Date: Mon May 5 19:12:20 CEST 2014 perf_pin_task_context() can return NULL but perf_event_init_context() assumes it will not, correct this. Signed-off-by: Peter Zijlstra --- kernel/events/core.c | 2 ++ 1 file changed, 2 insertions(+) --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -7745,6 +7745,8 @@ int perf_event_init_context(struct task_ * swapped under us. */ parent_ctx = perf_pin_task_context(parent, ctxn); + if (!parent_ctx) + return 0; /* * No need to check if parent_ctx != NULL here; since we saw