Commit bcdcd8e725b923ad7c0de809680d5d5658a7bf8c
Committed by
Linus Torvalds
1 parent
74489a91dd
Exists in
master
and in
39 other branches
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>
Showing 21 changed files with 24 additions and 2 deletions Side-by-side Diff
- Documentation/oops-tracing.txt
- arch/alpha/kernel/traps.c
- arch/arm/kernel/traps.c
- arch/arm26/kernel/traps.c
- arch/avr32/kernel/traps.c
- arch/i386/kernel/traps.c
- arch/ia64/kernel/traps.c
- arch/m68k/kernel/traps.c
- arch/m68knommu/kernel/traps.c
- arch/mips/kernel/traps.c
- arch/parisc/kernel/traps.c
- arch/powerpc/kernel/traps.c
- arch/ppc/kernel/traps.c
- arch/s390/kernel/traps.c
- arch/sh/kernel/traps.c
- arch/sparc/kernel/traps.c
- arch/sparc64/kernel/traps.c
- arch/x86_64/kernel/traps.c
- arch/xtensa/kernel/traps.c
- include/linux/kernel.h
- kernel/panic.c
Documentation/oops-tracing.txt
... | ... | @@ -251,6 +251,8 @@ |
251 | 251 | 7: 'U' if a user or user application specifically requested that the |
252 | 252 | Tainted flag be set, ' ' otherwise. |
253 | 253 | |
254 | + 8: 'D' if the kernel has died recently, i.e. there was an OOPS or BUG. | |
255 | + | |
254 | 256 | The primary reason for the 'Tainted: ' string is to tell kernel |
255 | 257 | debuggers if this is a clean kernel or if anything unusual has |
256 | 258 | occurred. Tainting is permanent: even if an offending module is |
arch/alpha/kernel/traps.c
arch/arm/kernel/traps.c
arch/arm26/kernel/traps.c
... | ... | @@ -185,6 +185,7 @@ |
185 | 185 | printk("Internal error: %s: %x\n", str, err); |
186 | 186 | printk("CPU: %d\n", smp_processor_id()); |
187 | 187 | show_regs(regs); |
188 | + add_taint(TAINT_DIE); | |
188 | 189 | printk("Process %s (pid: %d, stack limit = 0x%p)\n", |
189 | 190 | current->comm, current->pid, end_of_stack(tsk)); |
190 | 191 |
arch/avr32/kernel/traps.c
arch/i386/kernel/traps.c
arch/ia64/kernel/traps.c
arch/m68k/kernel/traps.c
arch/m68knommu/kernel/traps.c
arch/mips/kernel/traps.c
arch/parisc/kernel/traps.c
arch/powerpc/kernel/traps.c
arch/ppc/kernel/traps.c
arch/s390/kernel/traps.c
arch/sh/kernel/traps.c
arch/sparc/kernel/traps.c
arch/sparc64/kernel/traps.c
... | ... | @@ -2225,6 +2225,7 @@ |
2225 | 2225 | notify_die(DIE_OOPS, str, regs, 0, 255, SIGSEGV); |
2226 | 2226 | __asm__ __volatile__("flushw"); |
2227 | 2227 | __show_regs(regs); |
2228 | + add_taint(TAINT_DIE); | |
2228 | 2229 | if (regs->tstate & TSTATE_PRIV) { |
2229 | 2230 | struct reg_window *rw = (struct reg_window *) |
2230 | 2231 | (regs->u_regs[UREG_FP] + STACK_BIAS); |
arch/x86_64/kernel/traps.c
... | ... | @@ -518,6 +518,7 @@ |
518 | 518 | printk("\n"); |
519 | 519 | notify_die(DIE_OOPS, str, regs, err, current->thread.trap_no, SIGSEGV); |
520 | 520 | show_registers(regs); |
521 | + add_taint(TAINT_DIE); | |
521 | 522 | /* Executive summary in case the oops scrolled away */ |
522 | 523 | printk(KERN_ALERT "RIP "); |
523 | 524 | printk_address(regs->rip); |
arch/xtensa/kernel/traps.c
include/linux/kernel.h
kernel/panic.c
... | ... | @@ -159,14 +159,15 @@ |
159 | 159 | { |
160 | 160 | static char buf[20]; |
161 | 161 | if (tainted) { |
162 | - snprintf(buf, sizeof(buf), "Tainted: %c%c%c%c%c%c%c", | |
162 | + snprintf(buf, sizeof(buf), "Tainted: %c%c%c%c%c%c%c%c", | |
163 | 163 | tainted & TAINT_PROPRIETARY_MODULE ? 'P' : 'G', |
164 | 164 | tainted & TAINT_FORCED_MODULE ? 'F' : ' ', |
165 | 165 | tainted & TAINT_UNSAFE_SMP ? 'S' : ' ', |
166 | 166 | tainted & TAINT_FORCED_RMMOD ? 'R' : ' ', |
167 | 167 | tainted & TAINT_MACHINE_CHECK ? 'M' : ' ', |
168 | 168 | tainted & TAINT_BAD_PAGE ? 'B' : ' ', |
169 | - tainted & TAINT_USER ? 'U' : ' '); | |
169 | + tainted & TAINT_USER ? 'U' : ' ', | |
170 | + tainted & TAINT_DIE ? 'D' : ' '); | |
170 | 171 | } |
171 | 172 | else |
172 | 173 | snprintf(buf, sizeof(buf), "Not tainted"); |