Skip to content

Commit b0529be

Browse files
jpoimboeIngo Molnar
authored andcommitted
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 <jpoimboe@redhat.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Jiri Slaby <jslaby@suse.cz> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: live-patching@vger.kernel.org Fixes: 3b3fa11 ("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 <mingo@kernel.org>
1 parent 2995590 commit b0529be

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

arch/x86/kernel/dumpstack.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
9494
if (stack_name)
9595
printk("%s <%s>\n", log_lvl, stack_name);
9696

97+
if (regs && on_stack(&stack_info, regs, sizeof(*regs)))
98+
__show_regs(regs, 0);
99+
97100
/*
98101
* Scan the stack, printing any text addresses we find. At the
99102
* 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,
118121
* Don't print regs->ip again if it was already printed
119122
* by __show_regs() below.
120123
*/
121-
if (regs && stack == &regs->ip) {
122-
unwind_next_frame(&state);
123-
continue;
124-
}
124+
if (regs && stack == &regs->ip)
125+
goto next;
125126

126127
if (stack == ret_addr_p)
127128
reliable = 1;
@@ -144,6 +145,7 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
144145
if (!reliable)
145146
continue;
146147

148+
next:
147149
/*
148150
* Get the next frame from the unwinder. No need to
149151
* 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,
153155

154156
/* if the frame has entry regs, print them */
155157
regs = unwind_get_entry_regs(&state);
156-
if (regs)
158+
if (regs && on_stack(&stack_info, regs, sizeof(*regs)))
157159
__show_regs(regs, 0);
158160
}
159161

0 commit comments

Comments
 (0)