0141-x86-irq-64-Print-the-offending-IP-in-the-stack-overf.patch 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. From 3c131c80b6a5a95ab9a24e444ef02eba38710840 Mon Sep 17 00:00:00 2001
  2. From: Andy Lutomirski <[email protected]>
  3. Date: Mon, 4 Dec 2017 15:07:11 +0100
  4. Subject: [PATCH 141/232] x86/irq/64: Print the offending IP in the stack
  5. overflow warning
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. CVE-2017-5754
  10. In case something goes wrong with unwind (not unlikely in case of
  11. overflow), print the offending IP where we detected the overflow.
  12. Signed-off-by: Andy Lutomirski <[email protected]>
  13. Signed-off-by: Thomas Gleixner <[email protected]>
  14. Reviewed-by: Borislav Petkov <[email protected]>
  15. Reviewed-by: Thomas Gleixner <[email protected]>
  16. Cc: Boris Ostrovsky <[email protected]>
  17. Cc: Borislav Petkov <[email protected]>
  18. Cc: Borislav Petkov <[email protected]>
  19. Cc: Brian Gerst <[email protected]>
  20. Cc: Dave Hansen <[email protected]>
  21. Cc: Dave Hansen <[email protected]>
  22. Cc: David Laight <[email protected]>
  23. Cc: Denys Vlasenko <[email protected]>
  24. Cc: Eduardo Valentin <[email protected]>
  25. Cc: Greg KH <[email protected]>
  26. Cc: H. Peter Anvin <[email protected]>
  27. Cc: Josh Poimboeuf <[email protected]>
  28. Cc: Juergen Gross <[email protected]>
  29. Cc: Linus Torvalds <[email protected]>
  30. Cc: Peter Zijlstra <[email protected]>
  31. Cc: Rik van Riel <[email protected]>
  32. Cc: Will Deacon <[email protected]>
  33. Cc: [email protected]
  34. Cc: [email protected]
  35. Cc: [email protected]
  36. Cc: [email protected]
  37. Link: https://lkml.kernel.org/r/[email protected]
  38. Signed-off-by: Ingo Molnar <[email protected]>
  39. (cherry picked from commit 4f3789e792296e21405f708cf3cb409d7c7d5683)
  40. Signed-off-by: Andy Whitcroft <[email protected]>
  41. Signed-off-by: Kleber Sacilotto de Souza <[email protected]>
  42. (cherry picked from commit aa820446b0d31df0870b176257b40baadaf4444c)
  43. Signed-off-by: Fabian Grünbichler <[email protected]>
  44. ---
  45. arch/x86/kernel/irq_64.c | 4 ++--
  46. 1 file changed, 2 insertions(+), 2 deletions(-)
  47. diff --git a/arch/x86/kernel/irq_64.c b/arch/x86/kernel/irq_64.c
  48. index 3be74fbdeff2..feca14980e32 100644
  49. --- a/arch/x86/kernel/irq_64.c
  50. +++ b/arch/x86/kernel/irq_64.c
  51. @@ -56,10 +56,10 @@ static inline void stack_overflow_check(struct pt_regs *regs)
  52. if (regs->sp >= estack_top && regs->sp <= estack_bottom)
  53. return;
  54. - WARN_ONCE(1, "do_IRQ(): %s has overflown the kernel stack (cur:%Lx,sp:%lx,irq stk top-bottom:%Lx-%Lx,exception stk top-bottom:%Lx-%Lx)\n",
  55. + WARN_ONCE(1, "do_IRQ(): %s has overflown the kernel stack (cur:%Lx,sp:%lx,irq stk top-bottom:%Lx-%Lx,exception stk top-bottom:%Lx-%Lx,ip:%pF)\n",
  56. current->comm, curbase, regs->sp,
  57. irq_stack_top, irq_stack_bottom,
  58. - estack_top, estack_bottom);
  59. + estack_top, estack_bottom, (void *)regs->ip);
  60. if (sysctl_panic_on_stackoverflow)
  61. panic("low stack detected by irq handler - check messages\n");
  62. --
  63. 2.14.2