2
0

062-02-MIPS-Stack-unwinding-while-on-IRQ-stack.patch 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. From: Matt Redfearn <matt.redfearn@imgtec.com>
  2. Date: Mon, 19 Dec 2016 14:20:57 +0000
  3. Subject: [PATCH] MIPS: Stack unwinding while on IRQ stack
  4. Within unwind stack, check if the stack pointer being unwound is within
  5. the CPU's irq_stack and if so use that page rather than the task's stack
  6. page.
  7. Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
  8. ---
  9. --- a/arch/mips/kernel/process.c
  10. +++ b/arch/mips/kernel/process.c
  11. @@ -32,6 +32,7 @@
  12. #include <asm/cpu.h>
  13. #include <asm/dsp.h>
  14. #include <asm/fpu.h>
  15. +#include <asm/irq.h>
  16. #include <asm/msa.h>
  17. #include <asm/pgtable.h>
  18. #include <asm/mipsregs.h>
  19. @@ -507,7 +508,19 @@ EXPORT_SYMBOL(unwind_stack_by_address);
  20. unsigned long unwind_stack(struct task_struct *task, unsigned long *sp,
  21. unsigned long pc, unsigned long *ra)
  22. {
  23. - unsigned long stack_page = (unsigned long)task_stack_page(task);
  24. + unsigned long stack_page = 0;
  25. + int cpu;
  26. +
  27. + for_each_possible_cpu(cpu) {
  28. + if (on_irq_stack(cpu, *sp)) {
  29. + stack_page = (unsigned long)irq_stack[cpu];
  30. + break;
  31. + }
  32. + }
  33. +
  34. + if (!stack_page)
  35. + stack_page = (unsigned long)task_stack_page(task);
  36. +
  37. return unwind_stack_by_address(stack_page, sp, pc, ra);
  38. }
  39. #endif