Skip to content

Commit 5a3cf86

Browse files
jpoimboeIngo Molnar
authored andcommitted
x86/dumpstack: Fix interrupt and exception stack boundary checks
On x86_64, the double fault exception stack is located immediately after the interrupt stack in memory. This causes confusion in the unwinder when it tries to unwind through an empty interrupt stack, where the stack pointer points to the address bordering the two stacks. The unwinder incorrectly thinks it's running on the double fault stack. Fix this kind of stack border confusion by never considering the beginning address of an exception or interrupt stack to be part of the stack. 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: 5fe599e ("x86/dumpstack: Add support for unwinding empty IRQ stacks") Link: http://lkml.kernel.org/r/bcc142160a5104de5c354c21c394c93a0173943f.1499786555.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent b0529be commit 5a3cf86

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

arch/x86/kernel/dumpstack_32.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ static bool in_hardirq_stack(unsigned long *stack, struct stack_info *info)
3737
* This is a software stack, so 'end' can be a valid stack pointer.
3838
* It just means the stack is empty.
3939
*/
40-
if (stack < begin || stack > end)
40+
if (stack <= begin || stack > end)
4141
return false;
4242

4343
info->type = STACK_TYPE_IRQ;
@@ -62,7 +62,7 @@ static bool in_softirq_stack(unsigned long *stack, struct stack_info *info)
6262
* This is a software stack, so 'end' can be a valid stack pointer.
6363
* It just means the stack is empty.
6464
*/
65-
if (stack < begin || stack > end)
65+
if (stack <= begin || stack > end)
6666
return false;
6767

6868
info->type = STACK_TYPE_SOFTIRQ;

arch/x86/kernel/dumpstack_64.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static bool in_exception_stack(unsigned long *stack, struct stack_info *info)
5555
begin = end - (exception_stack_sizes[k] / sizeof(long));
5656
regs = (struct pt_regs *)end - 1;
5757

58-
if (stack < begin || stack >= end)
58+
if (stack <= begin || stack >= end)
5959
continue;
6060

6161
info->type = STACK_TYPE_EXCEPTION + k;
@@ -78,7 +78,7 @@ static bool in_irq_stack(unsigned long *stack, struct stack_info *info)
7878
* This is a software stack, so 'end' can be a valid stack pointer.
7979
* It just means the stack is empty.
8080
*/
81-
if (stack < begin || stack > end)
81+
if (stack <= begin || stack > end)
8282
return false;
8383

8484
info->type = STACK_TYPE_IRQ;

0 commit comments

Comments
 (0)