From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755502AbcAWB1l (ORCPT ); Fri, 22 Jan 2016 20:27:41 -0500 Received: from mga09.intel.com ([134.134.136.24]:5744 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754552AbcAWB1j (ORCPT ); Fri, 22 Jan 2016 20:27:39 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,334,1449561600"; d="scan'208";a="866579207" Date: Fri, 22 Jan 2016 17:27:38 -0800 From: Andi Kleen To: kernel test robot Cc: LKP , linux-kernel@vger.kernel.org, "Peter Zijlstra (Intel)" , Ingo Molnar , wfg@linux.intel.com Subject: Re: [perf/x86] 75925e1ad7: BUG: unable to handle kernel paging request at 000045b8 Message-ID: <20160123012738.GA28154@tassilo.jf.intel.com> References: <56a1b114.H5JOWAoJgA2/uN2W%fengguang.wu@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56a1b114.H5JOWAoJgA2/uN2W%fengguang.wu@intel.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 22, 2016 at 12:33:24PM +0800, kernel test robot wrote: > Greetings, > > 0day kernel testing robot got the below dmesg and the first bad commit is > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master Thanks. I managed to break 32bit kernels. The appended patch should fix it. ---- x86, perf: Fix perf user stack trace walking Fix 75925e1ad7 (perf/x86: Optimize stack walk user accesses) Replace the hard coded 64bit frame pointer sizes, with sizeof depending on the size of unsigned long on the host. This avoids a stack smash on 32bit kernels, which was dutifully reported by the 0day kbuild robot. Signed-off-by: Andi Kleen diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index 1b443db..ea4eb5c 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c @@ -2328,13 +2328,16 @@ perf_callchain_user(struct perf_callchain_entry *entry, struct pt_regs *regs) frame.next_frame = NULL; frame.return_address = 0; - if (!access_ok(VERIFY_READ, fp, 16)) + if (!access_ok(VERIFY_READ, fp, sizeof(frame))) break; - bytes = __copy_from_user_nmi(&frame.next_frame, fp, 8); + bytes = __copy_from_user_nmi(&frame.next_frame, fp, + sizeof(frame.next_frame)); if (bytes != 0) break; - bytes = __copy_from_user_nmi(&frame.return_address, fp+8, 8); + bytes = __copy_from_user_nmi(&frame.return_address, + fp + sizeof(frame.next_frame), + sizeof(frame.return_address)); if (bytes != 0) break;