Skip to content

Commit bcdcd8e

Browse files
xemulLinus Torvalds
authored andcommitted
Report that kernel is tainted if there was an OOPS
If the kernel OOPSed or BUGed then it probably should be considered as tainted. Thus, all subsequent OOPSes and SysRq dumps will report the tainted kernel. This saves a lot of time explaining oddities in the calltraces. Signed-off-by: Pavel Emelianov <xemul@openvz.org> Acked-by: Randy Dunlap <randy.dunlap@oracle.com> Cc: <linux-arch@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> [ Added parisc patch from Matthew Wilson -Linus ] Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 74489a9 commit bcdcd8e

21 files changed

Lines changed: 24 additions & 2 deletions

File tree

‎Documentation/oops-tracing.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ characters, each representing a particular tainted value.
251251
7: 'U' if a user or user application specifically requested that the
252252
Tainted flag be set, ' ' otherwise.
253253

254+
8: 'D' if the kernel has died recently, i.e. there was an OOPS or BUG.
255+
254256
The primary reason for the 'Tainted: ' string is to tell kernel
255257
debuggers if this is a clean kernel or if anything unusual has
256258
occurred. Tainting is permanent: even if an offending module is

‎arch/alpha/kernel/traps.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ die_if_kernel(char * str, struct pt_regs *regs, long err, unsigned long *r9_15)
184184
#endif
185185
printk("%s(%d): %s %ld\n", current->comm, current->pid, str, err);
186186
dik_show_regs(regs, r9_15);
187+
add_taint(TAINT_DIE);
187188
dik_show_trace((unsigned long *)(regs+1));
188189
dik_show_code((unsigned int *)regs->pc);
189190

‎arch/arm/kernel/traps.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ NORET_TYPE void die(const char *str, struct pt_regs *regs, int err)
249249
bust_spinlocks(1);
250250
__die(str, err, thread, regs);
251251
bust_spinlocks(0);
252+
add_taint(TAINT_DIE);
252253
spin_unlock_irq(&die_lock);
253254

254255
if (in_interrupt())

‎arch/arm26/kernel/traps.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ NORET_TYPE void die(const char *str, struct pt_regs *regs, int err)
185185
printk("Internal error: %s: %x\n", str, err);
186186
printk("CPU: %d\n", smp_processor_id());
187187
show_regs(regs);
188+
add_taint(TAINT_DIE);
188189
printk("Process %s (pid: %d, stack limit = 0x%p)\n",
189190
current->comm, current->pid, end_of_stack(tsk));
190191

‎arch/avr32/kernel/traps.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ void NORET_TYPE die(const char *str, struct pt_regs *regs, long err)
5656
show_regs_log_lvl(regs, KERN_EMERG);
5757
show_stack_log_lvl(current, regs->sp, regs, KERN_EMERG);
5858
bust_spinlocks(0);
59+
add_taint(TAINT_DIE);
5960
spin_unlock_irq(&die_lock);
6061

6162
if (in_interrupt())

‎arch/i386/kernel/traps.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ void die(const char * str, struct pt_regs * regs, long err)
433433

434434
bust_spinlocks(0);
435435
die.lock_owner = -1;
436+
add_taint(TAINT_DIE);
436437
spin_unlock_irqrestore(&die.lock, flags);
437438

438439
if (!regs)

‎arch/ia64/kernel/traps.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ die (const char *str, struct pt_regs *regs, long err)
6969

7070
bust_spinlocks(0);
7171
die.lock_owner = -1;
72+
add_taint(TAINT_DIE);
7273
spin_unlock_irq(&die.lock);
7374

7475
if (panic_on_oops)

‎arch/m68k/kernel/traps.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,6 +1170,7 @@ void die_if_kernel (char *str, struct pt_regs *fp, int nr)
11701170
console_verbose();
11711171
printk("%s: %08x\n",str,nr);
11721172
show_registers(fp);
1173+
add_taint(TAINT_DIE);
11731174
do_exit(SIGSEGV);
11741175
}
11751176

‎arch/m68knommu/kernel/traps.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ void die_if_kernel(char *str, struct pt_regs *fp, int nr)
8383
printk(KERN_EMERG "Process %s (pid: %d, stackpage=%08lx)\n",
8484
current->comm, current->pid, PAGE_SIZE+(unsigned long)current);
8585
show_stack(NULL, (unsigned long *)fp);
86+
add_taint(TAINT_DIE);
8687
do_exit(SIGSEGV);
8788
}
8889

‎arch/mips/kernel/traps.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ void __noreturn die(const char * str, struct pt_regs * regs)
326326
#endif /* CONFIG_MIPS_MT_SMTC */
327327
printk("%s[#%d]:\n", str, ++die_counter);
328328
show_registers(regs);
329+
add_taint(TAINT_DIE);
329330
spin_unlock_irq(&die_lock);
330331

331332
if (in_interrupt())

0 commit comments

Comments
 (0)