14 #include <linux/module.h>
38 static inline void stack_overflow_check(
struct pt_regs *
regs)
40 #ifdef CONFIG_DEBUG_STACKOVERFLOW
41 #define STACK_TOP_MARGIN 128
43 u64 irq_stack_top, irq_stack_bottom;
44 u64 estack_top, estack_bottom;
47 if (user_mode_vm(regs))
51 sizeof(
struct pt_regs) + STACK_TOP_MARGIN &&
58 if (regs->
sp >= irq_stack_top && regs->
sp <= irq_stack_bottom)
64 if (regs->
sp >= estack_top && regs->
sp <= estack_bottom)
67 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",
69 irq_stack_top, irq_stack_bottom,
70 estack_top, estack_bottom);
73 panic(
"low stack detected by irq handler - check messages\n");
81 stack_overflow_check(regs);
87 generic_handle_irq_desc(irq, desc);