Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752990AbdLEIzv (ORCPT ); Tue, 5 Dec 2017 03:55:51 -0500 Received: from mx2.suse.de ([195.135.220.15]:34902 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752786AbdLEIzl (ORCPT ); Tue, 5 Dec 2017 03:55:41 -0500 From: Jiri Slaby To: mingo@redhat.com Cc: live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Jiri Slaby , Thomas Gleixner , "H. Peter Anvin" , x86@kernel.org, Josh Poimboeuf Subject: [PATCH v2 4/5] x86/stacktrace: do not fail for ORC with regs on stack Date: Tue, 5 Dec 2017 09:55:37 +0100 Message-Id: <20171205085538.24322-4-jslaby@suse.cz> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171205085538.24322-1-jslaby@suse.cz> References: <20171205085538.24322-1-jslaby@suse.cz> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org save_stack_trace_reliable now returns "non reliable" when there are kernel pt_regs on stack. This means an interrupt or exception happened somewhere down the route. It is a problem for frame pointer unwinder, because the frame might not have been set up yet when the irq happened, so the unwinder might fail to unwind from the interrupted function. With ORC, this is not a problem, as ORC has out-of-band data. We can find ORC data even for the IP in the interrupted function and always unwind one level up reliably. So lift the check to apply only when CONFIG_FRAME_POINTER is enabled. [v2] - rewrite the code in favor of Josh's suggestions Signed-off-by: Jiri Slaby Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: x86@kernel.org Cc: Josh Poimboeuf --- arch/x86/kernel/stacktrace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c index 9da8af2922b6..45915bd01692 100644 --- a/arch/x86/kernel/stacktrace.c +++ b/arch/x86/kernel/stacktrace.c @@ -113,7 +113,8 @@ __save_stack_trace_reliable(struct stack_trace *trace, * or a page fault), which can make frame pointers * unreliable. */ - return -EINVAL; + if (IS_ENABLED(CONFIG_FRAME_POINTER)) + return -EINVAL; } addr = unwind_get_return_address(&state); -- 2.15.1