Report that kernel is tainted if there were an OOPS before
Subsystems (8)
PATCH 1/1 Report that kernel is tainted if there were an OOPS before
If the kernel OOPS-ed or BUG-ed then it probably should considered as tainted. Use die_counter introduced by many architectures to determine whether or not the kernel died.
This saves a lot of time explaining oddities in the calltrace seen via SysRq-P.
arch/arm/kernel/traps.c +0 -1
@@ -207,7 +207,6 @@ void show_stack(struct task_struct *tsk,static void __die (const char *str,int err,struct thread_info *thread,struct pt_regs *regs) {struct task_struct *tsk = thread->task; -static int die_counter;printk ("Internal error: %s: %x [#%d]\n" , str, err, ++die_counter);print_modules ();
arch/avr32/kernel/traps.c +0 -2
@@ -156,8 +156,6 @@ static DEFINE_SPINLOCK(die_lock); void NORET_TYPE die(const char *str, struct pt_regs *regs, long err) { -static int die_counter; -console_verbose ();spin_lock_irq (&die_lock);bust_spinlocks (1 );
arch/i386/kernel/traps.c +0 -1
@@ -438,7 +438,6 @@ void die(const char * str, struct pt_reg .lock_owner = -1, .lock_owner_depth = 0 }; -static int die_counter;unsigned long flags;oops_enter ();
arch/ia64/kernel/traps.c +0 -1
@@ -47,7 +47,6 @@ die (const char *str, struct pt_regs *re .lock_owner = -1, .lock_owner_depth = 0 }; -static int die_counter;int cpu =get_cpu ();if (die.lock_owner != cpu) {
arch/mips/kernel/traps.c +0 -1
@@ -312,7 +312,6 @@ static DEFINE_SPINLOCK(die_lock); NORET_TYPE void ATTRIB_NORET die(const char * str, struct pt_regs * regs) { -static int die_counter;#ifdef CONFIG_MIPS_MT_SMTC unsigned long dvpret =dvpe ();#endif /* CONFIG_MIPS_MT_SMTC */
arch/powerpc/kernel/traps.c +0 -1
@@ -105,7 +105,6 @@ int die(const char *str, struct pt_regs .lock_owner = -1, .lock_owner_depth = 0 }; -static int die_counter;unsigned long flags;if (debugger (regs))
arch/ppc/kernel/traps.c +0 -1
@@ -76,7 +76,6 @@ DEFINE_SPINLOCK(die_lock);int die (const char * str,struct pt_regs * fp,long err) { -static int die_counter;int nl =0 ;console_verbose ();spin_lock_irq (&die_lock);
arch/s390/kernel/traps.c +0 -2
@@ -251,8 +251,6 @@ static DEFINE_SPINLOCK(die_lock);void die (const char * str,struct pt_regs * regs,long err) { -static int die_counter; -debug_stop_all ();console_verbose ();spin_lock_irq (&die_lock);
arch/sh/kernel/traps.c +0 -2
@@ -78,8 +78,6 @@ DEFINE_SPINLOCK(die_lock);void die (const char * str,struct pt_regs * regs,long err) { -static int die_counter; -console_verbose ();spin_lock_irq (&die_lock);bust_spinlocks (1 );
arch/sparc/kernel/traps.c +0 -1
@@ -89,7 +89,6 @@ void instruction_dump (unsigned long *pcvoid die_if_kernel (char *str,struct pt_regs *regs) { -static int die_counter;int count =0 ;/* Amuse the user. */
arch/sparc64/kernel/traps.c +0 -1
@@ -2208,7 +2208,6 @@ static inline struct reg_window *kernel_void die_if_kernel (char *str,struct pt_regs *regs) { -static int die_counter;extern void smp_report_regs (void );int count =0 ;
arch/x86_64/kernel/traps.c +0 -1
@@ -570,7 +570,6 @@ void __kprobes oops_end(unsigned long flvoid __kprobes __die (const char * str,struct pt_regs * regs,long err) { -static int die_counter;printk (KERN_EMERG "%s: %04lx [%u] " , str, err &0xffff ,++die_counter);#ifdef CONFIG_PREEMPT printk ("PREEMPT " );
arch/xtensa/kernel/traps.c +0 -1
@@ -465,7 +465,6 @@ DEFINE_SPINLOCK(die_lock);void die (const char * str,struct pt_regs * regs,long err) { -static int die_counter;int nl =0 ;console_verbose ();
include/linux/kernel.h +1 -0
@@ -202,6 +202,7 @@ extern enum system_states {#define TAINT_USER (1<<6)extern void dump_stack (void ); +extern int die_counter;#ifdef DEBUG /* If you are writing a driver, please use dev_dbg instead */
kernel/panic.c +7 -3
@@ -150,23 +150,27 @@ EXPORT_SYMBOL(panic);* 'R' - User forced a module unload. * 'M' - Machine had a machine check experience. * 'B' - System has hit bad_page. +* 'D' - An OOPS has hapened. * 'U' - Userspace-defined naughtiness. * * The string is overwritten by the next call to print_taint(). */ + +int die_counter;const char *print_tainted (void ) {static char buf[20 ]; -if (tainted) { -snprintf (buf,sizeof (buf),"Tainted: %c%c%c%c%c%c%c" , +if (tainted || die_counter) { +snprintf (buf,sizeof (buf),"Tainted: %c%c%c%c%c%c%c%c" , tainted &TAINT_PROPRIETARY_MODULE ?'P' :'G' , tainted &TAINT_FORCED_MODULE ?'F' :' ' , tainted &TAINT_UNSAFE_SMP ?'S' :' ' , tainted &TAINT_FORCED_RMMOD ?'R' :' ' , tainted &TAINT_MACHINE_CHECK ?'M' :' ' , tainted &TAINT_BAD_PAGE ?'B' :' ' , - tainted &TAINT_USER ?'U' :' ' ); + tainted &TAINT_USER ?'U' :' ' , + die_counter ?'D' :' ' ); }else snprintf (buf,sizeof (buf),"Not tainted" );
Quoted 6 lines · On Mon, 16 Apr 2007 14:23:26 +0400 Pavel Emelianov wrote:
If the kernel OOPS-ed or BUG-ed then it probably should considered as tainted. Use
die_counterintroduced by many architectures to determine whether or not the kernel died.This saves a lot of time explaining oddities in the calltrace seen via SysRq-P.
argh, attachment...
+ * 'D' - An OOPS has hapened.
happened.
You also need to update Documentation/oops-tracing.txt.
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***