Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751494AbdGRKrY (ORCPT ); Tue, 18 Jul 2017 06:47:24 -0400 Received: from terminus.zytor.com ([65.50.211.136]:53559 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751322AbdGRKrX (ORCPT ); Tue, 18 Jul 2017 06:47:23 -0400 Date: Tue, 18 Jul 2017 03:41:43 -0700 From: tip-bot for Josh Poimboeuf Message-ID: Cc: efault@gmx.de, torvalds@linux-foundation.org, tglx@linutronix.de, jpoimboe@redhat.com, luto@kernel.org, linux-kernel@vger.kernel.org, mingo@kernel.org, dvlasenk@redhat.com, peterz@infradead.org, jslaby@suse.cz, hpa@zytor.com, brgerst@gmail.com, bp@alien8.de Reply-To: brgerst@gmail.com, hpa@zytor.com, bp@alien8.de, dvlasenk@redhat.com, mingo@kernel.org, luto@kernel.org, linux-kernel@vger.kernel.org, peterz@infradead.org, jslaby@suse.cz, torvalds@linux-foundation.org, tglx@linutronix.de, jpoimboe@redhat.com, efault@gmx.de In-Reply-To: <269c5c00c7d45c699f3dcea42a3a594c6cf7a9a3.1499786555.git.jpoimboe@redhat.com> References: <269c5c00c7d45c699f3dcea42a3a594c6cf7a9a3.1499786555.git.jpoimboe@redhat.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:x86/asm] x86/dumpstack: Fix occasionally missing registers Git-Commit-ID: b0529becebde629ff6abf2afdca6def6824f4fa9 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: 2775 Lines: 75 Commit-ID: b0529becebde629ff6abf2afdca6def6824f4fa9 Gitweb: http://git.kernel.org/tip/b0529becebde629ff6abf2afdca6def6824f4fa9 Author: Josh Poimboeuf AuthorDate: Tue, 11 Jul 2017 10:33:40 -0500 Committer: Ingo Molnar CommitDate: Tue, 18 Jul 2017 10:56:23 +0200 x86/dumpstack: Fix occasionally missing registers If two consecutive stack frames have pt_regs, the oops dump code fails to print the second frame's registers. Fix that. Signed-off-by: Josh Poimboeuf Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Brian Gerst Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Jiri Slaby Cc: Linus Torvalds Cc: Mike Galbraith Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: live-patching@vger.kernel.org Fixes: 3b3fa11bc700 ("x86/dumpstack: Print any pt_regs found on the stack") Link: http://lkml.kernel.org/r/269c5c00c7d45c699f3dcea42a3a594c6cf7a9a3.1499786555.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar --- arch/x86/kernel/dumpstack.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c index dbce3cc..bd265a4 100644 --- a/arch/x86/kernel/dumpstack.c +++ b/arch/x86/kernel/dumpstack.c @@ -94,6 +94,9 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, if (stack_name) printk("%s <%s>\n", log_lvl, stack_name); + if (regs && on_stack(&stack_info, regs, sizeof(*regs))) + __show_regs(regs, 0); + /* * Scan the stack, printing any text addresses we find. At the * same time, follow proper stack frames with the unwinder. @@ -118,10 +121,8 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, * Don't print regs->ip again if it was already printed * by __show_regs() below. */ - if (regs && stack == ®s->ip) { - unwind_next_frame(&state); - continue; - } + if (regs && stack == ®s->ip) + goto next; if (stack == ret_addr_p) reliable = 1; @@ -144,6 +145,7 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, if (!reliable) continue; +next: /* * Get the next frame from the unwinder. No need to * check for an error: if anything goes wrong, the rest @@ -153,7 +155,7 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs, /* if the frame has entry regs, print them */ regs = unwind_get_entry_regs(&state); - if (regs) + if (regs && on_stack(&stack_info, regs, sizeof(*regs))) __show_regs(regs, 0); }