Commit ce384d83 authored by Yury Polyanskiy's avatar Yury Polyanskiy Committed by Ralf Baechle

MIPS: die() does not call die notifier chain

The MIPS implementation of die() forgets to call notify_die() and thus notifiers
registered via register_die_notifier() are not called.  This results in kgdb not
being activated on exceptions.

The only subtlety is that notify_die declares its regs argument w/o const, so
the const had to be removed from mips die() as well.

[Ralf: Fixed build error for SGI IP22 and IP28 platforms.]
Signed-off-by: default avatarYury Polyanskiy <ypolyans@princeton.edu>
Cc: linux-mips@linux-mips.org
Patchworks: http://patchwork.linux-mips.org/patch/1142/Acked-by: default avatarJason Wessel <jason.wessel@windriver.com>
Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>

---
parent fcf3ca4c
...@@ -142,9 +142,9 @@ extern int ptrace_set_watch_regs(struct task_struct *child, ...@@ -142,9 +142,9 @@ extern int ptrace_set_watch_regs(struct task_struct *child,
extern asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit); extern asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit);
extern NORET_TYPE void die(const char *, const struct pt_regs *) ATTRIB_NORET; extern NORET_TYPE void die(const char *, struct pt_regs *) ATTRIB_NORET;
static inline void die_if_kernel(const char *str, const struct pt_regs *regs) static inline void die_if_kernel(const char *str, struct pt_regs *regs)
{ {
if (unlikely(!user_mode(regs))) if (unlikely(!user_mode(regs)))
die(str, regs); die(str, regs);
......
...@@ -352,9 +352,10 @@ void show_registers(const struct pt_regs *regs) ...@@ -352,9 +352,10 @@ void show_registers(const struct pt_regs *regs)
static DEFINE_SPINLOCK(die_lock); static DEFINE_SPINLOCK(die_lock);
void __noreturn die(const char * str, const struct pt_regs * regs) void __noreturn die(const char * str, struct pt_regs * regs)
{ {
static int die_counter; static int die_counter;
int sig = SIGSEGV;
#ifdef CONFIG_MIPS_MT_SMTC #ifdef CONFIG_MIPS_MT_SMTC
unsigned long dvpret = dvpe(); unsigned long dvpret = dvpe();
#endif /* CONFIG_MIPS_MT_SMTC */ #endif /* CONFIG_MIPS_MT_SMTC */
...@@ -365,6 +366,10 @@ void __noreturn die(const char * str, const struct pt_regs * regs) ...@@ -365,6 +366,10 @@ void __noreturn die(const char * str, const struct pt_regs * regs)
#ifdef CONFIG_MIPS_MT_SMTC #ifdef CONFIG_MIPS_MT_SMTC
mips_mt_regdump(dvpret); mips_mt_regdump(dvpret);
#endif /* CONFIG_MIPS_MT_SMTC */ #endif /* CONFIG_MIPS_MT_SMTC */
if (notify_die(DIE_OOPS, str, regs, 0, current->thread.trap_no, SIGSEGV) == NOTIFY_STOP)
sig = 0;
printk("%s[#%d]:\n", str, ++die_counter); printk("%s[#%d]:\n", str, ++die_counter);
show_registers(regs); show_registers(regs);
add_taint(TAINT_DIE); add_taint(TAINT_DIE);
...@@ -379,7 +384,7 @@ void __noreturn die(const char * str, const struct pt_regs * regs) ...@@ -379,7 +384,7 @@ void __noreturn die(const char * str, const struct pt_regs * regs)
panic("Fatal exception"); panic("Fatal exception");
} }
do_exit(SIGSEGV); do_exit(sig);
} }
extern struct exception_table_entry __start___dbe_table[]; extern struct exception_table_entry __start___dbe_table[];
......
...@@ -89,7 +89,7 @@ static void print_buserr(void) ...@@ -89,7 +89,7 @@ static void print_buserr(void)
void ip22_be_interrupt(int irq) void ip22_be_interrupt(int irq)
{ {
const int field = 2 * sizeof(unsigned long); const int field = 2 * sizeof(unsigned long);
const struct pt_regs *regs = get_irq_regs(); struct pt_regs *regs = get_irq_regs();
save_and_clear_buserr(); save_and_clear_buserr();
print_buserr(); print_buserr();
......
...@@ -453,7 +453,7 @@ mips_be_fatal: ...@@ -453,7 +453,7 @@ mips_be_fatal:
void ip22_be_interrupt(int irq) void ip22_be_interrupt(int irq)
{ {
const struct pt_regs *regs = get_irq_regs(); struct pt_regs *regs = get_irq_regs();
count_be_interrupt++; count_be_interrupt++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment