1 Tainted kernels 2 --------------- 3 4 The kernel will mark itself as 'tainted' when 5 relevant later when investigating problems. Do 6 most of the time it's not a problem to run a t 7 mainly of interest once someone wants to inves 8 cause might be the event that got the kernel t 9 from tainted kernels will often be ignored by 10 problems with an untainted kernel. 11 12 Note the kernel will remain tainted even after 13 (i.e. unload a proprietary kernel module), to 14 trustworthy. That's also why the kernel will p 15 notices an internal problem (a 'kernel bug'), 16 ('kernel oops') or a non-recoverable error ('k 17 information about this to the logs ``dmesg`` o 18 check the tainted state at runtime through a f 19 20 21 Tainted flag in bugs, oops or panics messages 22 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 23 24 You find the tainted state near the top in a l 25 why the kernel was tainted is shown after the 26 name of the command ('Comm:') that triggered t 27 28 BUG: unable to handle kernel NULL poin 29 Oops: 0002 [#1] SMP PTI 30 CPU: 0 PID: 4424 Comm: insmod Tainted: 31 Hardware name: Red Hat KVM, BIOS 0.5.1 32 RIP: 0010:my_oops_init+0x13/0x1000 [kp 33 [...] 34 35 You'll find a 'Not tainted: ' there if the ker 36 time of the event; if it was, then it will pri 37 either letters or blanks. In the example above 38 39 Tainted: P W O 40 41 The meaning of those characters is explained i 42 the kernel got tainted earlier because a propr 43 a warning occurred (``W``), and an externally- 44 To decode other letters use the table below. 45 46 47 Decoding tainted state at runtime 48 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 49 50 At runtime, you can query the tainted state by 51 ``cat /proc/sys/kernel/tainted``. If that retu 52 tainted; any other number indicates the reason 53 decode that number is the script ``tools/debug 54 distribution might ship as part of a package c 55 ``kernel-tools``; if it doesn't, you can downl 56 `git.kernel.org <https://git.kernel.org/pub/sc 57 and execute it with ``sh kernel-chktaint``, wh 58 this on the machine that had the statements in 59 60 Kernel is Tainted for following reason 61 * Proprietary module was loaded (#0) 62 * Kernel issued warning (#9) 63 * Externally-built ('out-of-tree') mo 64 See Documentation/admin-guide/tainted- 65 https://www.kernel.org/doc/html/lates 66 a more details explanation of the var 67 Raw taint value as int/string: 4609/'P 68 69 You can try to decode the number yourself. Tha 70 reason that got your kernel tainted, as in thi 71 with the table below. If there were multiple r 72 number, as it is a bitfield, where each bit in 73 a particular type of taint. It's best to leave 74 script, but if you need something quick you ca 75 which bits are set:: 76 77 $ for i in $(seq 18); do echo $(($i-1) 78 79 Table for decoding tainted state 80 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 81 82 === === ====== ============================ 83 Bit Log Number Reason that got the kernel t 84 === === ====== ============================ 85 0 G/P 1 proprietary module was loade 86 1 _/F 2 module was force loaded 87 2 _/S 4 kernel running on an out of 88 3 _/R 8 module was force unloaded 89 4 _/M 16 processor reported a Machine 90 5 _/B 32 bad page referenced or some 91 6 _/U 64 taint requested by userspace 92 7 _/D 128 kernel died recently, i.e. t 93 8 _/A 256 ACPI table overridden by use 94 9 _/W 512 kernel issued warning 95 10 _/C 1024 staging driver was loaded 96 11 _/I 2048 workaround for bug in platfo 97 12 _/O 4096 externally-built ("out-of-tr 98 13 _/E 8192 unsigned module was loaded 99 14 _/L 16384 soft lockup occurred 100 15 _/K 32768 kernel has been live patched 101 16 _/X 65536 auxiliary taint, defined for 102 17 _/T 131072 kernel was built with the st 103 18 _/N 262144 an in-kernel test has been r 104 === === ====== ============================ 105 106 Note: The character ``_`` is representing a bl 107 easier. 108 109 More detailed explanation for tainting 110 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 111 112 0) ``G`` if all modules loaded have a GPL or 113 any proprietary module has been loaded. 114 MODULE_LICENSE or with a MODULE_LICENSE t 115 insmod as GPL compatible are assumed to b 116 117 1) ``F`` if any module was force loaded by ` 118 modules were loaded normally. 119 120 2) ``S`` if the kernel is running on a proce 121 specification: hardware has been put into 122 therefore proper execution cannot be guar 123 Kernel will be tainted if, for example: 124 125 - on x86: PAE is forced through forcepae 126 which do not report PAE but may have a 127 kernel is running on non officially cap 128 being poked at from userspace. 129 - on arm: kernel running on certain CPUs 130 having certain kernel features enabled. 131 - on arm64: there are mismatched hardware 132 bootloader has booted CPUs in different 133 - certain drivers are being used on non s 134 scsi/snic on something else than x86_64 135 x86/x86_64/itanium, have broken firmwar 136 irqchip/irq-gic on arm64 ...). 137 - x86/x86_64: Microcode late loading is d 138 tainting the kernel. It requires that a 139 the update happens when the system is a 140 a higher priority MCE/SMI/NMI can move 141 rendezvous and interrupt the update, wh 142 machine. 143 144 3) ``R`` if a module was force unloaded by ` 145 modules were unloaded normally. 146 147 4) ``M`` if any processor has reported a Mac 148 ``' '`` if no Machine Check Exceptions ha 149 150 5) ``B`` If a page-release function has foun 151 unexpected page flags. This indicates a h 152 there should be other information in the 153 occurred. 154 155 6) ``U`` if a user or user application speci 156 Tainted flag be set, ``' '`` otherwise. 157 158 7) ``D`` if the kernel has died recently, i. 159 160 8) ``A`` if an ACPI table has been overridde 161 162 9) ``W`` if a warning has previously been is 163 (Though some warnings may set more specif 164 165 10) ``C`` if a staging driver has been loaded 166 167 11) ``I`` if the kernel is working around a s 168 firmware (BIOS or similar). 169 170 12) ``O`` if an externally-built ("out-of-tre 171 172 13) ``E`` if an unsigned module has been load 173 module signature. 174 175 14) ``L`` if a soft lockup has previously occ 176 177 15) ``K`` if the kernel has been live patched 178 179 16) ``X`` Auxiliary taint, defined for and us 180 181 17) ``T`` Kernel was build with the randstruc 182 produce extremely unusual kernel structur 183 pathological ones), which is important to 184 build time.
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.