die() does not call die notifier chain
Subsystems (2)
PATCH 1/1 die() does not call die notifier chain
Dear Ralf,
I think that the arch/mips implementation of die() forgets to call the notify_die() and thus notifiers registered via register_die_notifier() are not called.
For example this results in kgdb not being activated on exceptions.
The patch is very simple and attached: the only subtlety is that main notify_die declares regs argument w/o const, so I needed to remove const from mips die() as well.
Best wishes,
Yury.
PS. Please CC me: I am not on the list.
arch/mips/include/asm/ptrace.h +2 -2
@@ -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 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)))die (str, regs);
arch/mips/kernel/traps.c +7 -2
@@ -352,9 +352,10 @@ void show_registers(const struct pt_regs *regs)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; +int sig =SIGSEGV ;#ifdef CONFIG_MIPS_MT_SMTC unsigned long dvpret =dvpe ();#endif /* CONFIG_MIPS_MT_SMTC */
@@ -365,6 +366,10 @@ void __noreturn die(const char * str, const struct pt_regs * regs)#ifdef CONFIG_MIPS_MT_SMTC mips_mt_regdump (dvpret);#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);show_registers (regs);add_taint (TAINT_DIE );
@@ -379,7 +384,7 @@ void __noreturn die(const char * str, const struct pt_regs * regs)panic ("Fatal exception" ); } -do_exit (SIGSEGV ); +do_exit (sig); }extern struct exception_table_entry __start___dbe_table[];
On Mon, Apr 26, 2010 at 12:53:10AM -0400, Yury Polyanskiy wrote:
Yuri,
Quoted 9 lines
I think that the
arch/mipsimplementation ofdie()forgets to call thenotify_die()and thus notifiers registered viaregister_die_notifier()are not called.For example this results in kgdb not being activated on exceptions.
The patch is very simple and attached: the only subtlety is that main
notify_diedeclares regs argument w/o const, so I needed to remove const from mipsdie()as well.
I'd have prefered to make all users of the reg pointer const in the hope gcc can use that for optimization and to avoid stupid assignments via that pointer but that turns out a significant problem on its own so I'm applying your patch as is.
Please include a Signed-off-by: line (see Documentation/SubmittingPatches) in future patches. If your patch was any more complex than this I'd not have considered it without one.
Thanks!
Ralf