diff options
author | Matt Redfearn <matt.redfearn@imgtec.com> | 2016-12-19 09:20:57 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2017-01-03 10:34:34 -0500 |
commit | d42d8d106b0275b027c1e8992c42aecf933436ea (patch) | |
tree | cf5b3f4a09288a5d2a941a19458bb159cbada948 /arch/mips/kernel/process.c | |
parent | fe8bd18ffea5327344d4ec2bf11f47951212abd0 (diff) |
MIPS: Stack unwinding while on IRQ stack
Within unwind stack, check if the stack pointer being unwound is within
the CPU's irq_stack and if so use that page rather than the task's stack
page.
Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
Acked-by: Jason A. Donenfeld <jason@zx2c4.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Adam Buchbinder <adam.buchbinder@gmail.com>
Cc: Maciej W. Rozycki <macro@imgtec.com>
Cc: Marcin Nowakowski <marcin.nowakowski@imgtec.com>
Cc: Chris Metcalf <cmetcalf@mellanox.com>
Cc: James Hogan <james.hogan@imgtec.com>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/14741/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel/process.c')
-rw-r--r-- | arch/mips/kernel/process.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c index 5142b1dfe8a7..48e30e0469ef 100644 --- a/arch/mips/kernel/process.c +++ b/arch/mips/kernel/process.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <asm/dsemul.h> | 33 | #include <asm/dsemul.h> |
34 | #include <asm/dsp.h> | 34 | #include <asm/dsp.h> |
35 | #include <asm/fpu.h> | 35 | #include <asm/fpu.h> |
36 | #include <asm/irq.h> | ||
36 | #include <asm/msa.h> | 37 | #include <asm/msa.h> |
37 | #include <asm/pgtable.h> | 38 | #include <asm/pgtable.h> |
38 | #include <asm/mipsregs.h> | 39 | #include <asm/mipsregs.h> |
@@ -511,7 +512,19 @@ EXPORT_SYMBOL(unwind_stack_by_address); | |||
511 | unsigned long unwind_stack(struct task_struct *task, unsigned long *sp, | 512 | unsigned long unwind_stack(struct task_struct *task, unsigned long *sp, |
512 | unsigned long pc, unsigned long *ra) | 513 | unsigned long pc, unsigned long *ra) |
513 | { | 514 | { |
514 | unsigned long stack_page = (unsigned long)task_stack_page(task); | 515 | unsigned long stack_page = 0; |
516 | int cpu; | ||
517 | |||
518 | for_each_possible_cpu(cpu) { | ||
519 | if (on_irq_stack(cpu, *sp)) { | ||
520 | stack_page = (unsigned long)irq_stack[cpu]; | ||
521 | break; | ||
522 | } | ||
523 | } | ||
524 | |||
525 | if (!stack_page) | ||
526 | stack_page = (unsigned long)task_stack_page(task); | ||
527 | |||
515 | return unwind_stack_by_address(stack_page, sp, pc, ra); | 528 | return unwind_stack_by_address(stack_page, sp, pc, ra); |
516 | } | 529 | } |
517 | #endif | 530 | #endif |