Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752916AbcKRJHC (ORCPT ); Fri, 18 Nov 2016 04:07:02 -0500 Received: from terminus.zytor.com ([198.137.202.10]:51020 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752247AbcKRJG7 (ORCPT ); Fri, 18 Nov 2016 04:06:59 -0500 Date: Fri, 18 Nov 2016 01:04:21 -0800 From: tip-bot for Josh Poimboeuf Message-ID: Cc: hpa@zytor.com, eranian@gmail.com, acme@kernel.org, jpoimboe@redhat.com, linux-kernel@vger.kernel.org, vincent.weaver@maine.edu, mingo@kernel.org, brgerst@gmail.com, tglx@linutronix.de, bp@alien8.de, luto@kernel.org, dvlasenk@redhat.com, torvalds@linux-foundation.org, peterz@infradead.org Reply-To: dvlasenk@redhat.com, peterz@infradead.org, torvalds@linux-foundation.org, vincent.weaver@maine.edu, mingo@kernel.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, bp@alien8.de, brgerst@gmail.com, luto@kernel.org, jpoimboe@redhat.com, eranian@gmail.com, hpa@zytor.com, acme@kernel.org In-Reply-To: <61939c0b2b2d63ce97ba59cba3b00fd47c2962cf.1479398226.git.jpoimboe@redhat.com> References: <61939c0b2b2d63ce97ba59cba3b00fd47c2962cf.1479398226.git.jpoimboe@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/urgent] x86/unwind: Prevent KASAN false positive warnings in guess unwinder Git-Commit-ID: c2d75e03d6307bda0e14b616818a6f7b09fd623a X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2223 Lines: 63 Commit-ID: c2d75e03d6307bda0e14b616818a6f7b09fd623a Gitweb: http://git.kernel.org/tip/c2d75e03d6307bda0e14b616818a6f7b09fd623a Author: Josh Poimboeuf AuthorDate: Thu, 17 Nov 2016 09:57:23 -0600 Committer: Ingo Molnar CommitDate: Fri, 18 Nov 2016 09:38:00 +0100 x86/unwind: Prevent KASAN false positive warnings in guess unwinder The guess unwinder scans the entire stack, which can cause KASAN "stack-out-of-bounds" false positive warnings. Tell KASAN to ignore it. Reported-by: Peter Zijlstra Signed-off-by: Josh Poimboeuf Cc: Andy Lutomirski Cc: Arnaldo Carvalho de Melo Cc: Borislav Petkov Cc: Brian Gerst Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Stephane Eranian Cc: Thomas Gleixner Cc: Vince Weaver Cc: davej@codemonkey.org.uk Cc: dvyukov@google.com Link: http://lkml.kernel.org/r/61939c0b2b2d63ce97ba59cba3b00fd47c2962cf.1479398226.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar --- arch/x86/kernel/unwind_guess.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/unwind_guess.c b/arch/x86/kernel/unwind_guess.c index 2d721e5..b80e8bf 100644 --- a/arch/x86/kernel/unwind_guess.c +++ b/arch/x86/kernel/unwind_guess.c @@ -7,11 +7,13 @@ unsigned long unwind_get_return_address(struct unwind_state *state) { + unsigned long addr = READ_ONCE_NOCHECK(*state->sp); + if (unwind_done(state)) return 0; return ftrace_graph_ret_addr(state->task, &state->graph_idx, - *state->sp, state->sp); + addr, state->sp); } EXPORT_SYMBOL_GPL(unwind_get_return_address); @@ -23,8 +25,10 @@ bool unwind_next_frame(struct unwind_state *state) return false; do { + unsigned long addr = READ_ONCE_NOCHECK(*state->sp); + for (state->sp++; state->sp < info->end; state->sp++) - if (__kernel_text_address(*state->sp)) + if (__kernel_text_address(addr)) return true; state->sp = info->next_sp;