1 Tainted kernels 1 Tainted kernels 2 --------------- 2 --------------- 3 3 4 The kernel will mark itself as 'tainted' when !! 4 Some oops reports contain the string **'Tainted: '** after the program 5 relevant later when investigating problems. Do !! 5 counter. This indicates that the kernel has been tainted by some 6 most of the time it's not a problem to run a t !! 6 mechanism. The string is followed by a series of position-sensitive 7 mainly of interest once someone wants to inves !! 7 characters, each representing a particular tainted value. 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 8 106 Note: The character ``_`` is representing a bl !! 9 1) ``G`` if all modules loaded have a GPL or compatible license, ``P`` if 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. 10 any proprietary module has been loaded. Modules without a 114 MODULE_LICENSE or with a MODULE_LICENSE t 11 MODULE_LICENSE or with a MODULE_LICENSE that is not recognised by 115 insmod as GPL compatible are assumed to b 12 insmod as GPL compatible are assumed to be proprietary. 116 13 117 1) ``F`` if any module was force loaded by ` !! 14 2) ``F`` if any module was force loaded by ``insmod -f``, ``' '`` if all 118 modules were loaded normally. 15 modules were loaded normally. 119 16 120 2) ``S`` if the kernel is running on a proce !! 17 3) ``S`` if the oops occurred on an SMP kernel running on hardware that 121 specification: hardware has been put into !! 18 hasn't been certified as safe to run multiprocessor. 122 therefore proper execution cannot be guar !! 19 Currently this occurs only on various Athlons that are not 123 Kernel will be tainted if, for example: !! 20 SMP capable. 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 21 144 3) ``R`` if a module was force unloaded by ` !! 22 4) ``R`` if a module was force unloaded by ``rmmod -f``, ``' '`` if all 145 modules were unloaded normally. 23 modules were unloaded normally. 146 24 147 4) ``M`` if any processor has reported a Mac !! 25 5) ``M`` if any processor has reported a Machine Check Exception, 148 ``' '`` if no Machine Check Exceptions ha 26 ``' '`` if no Machine Check Exceptions have occurred. 149 27 150 5) ``B`` If a page-release function has foun !! 28 6) ``B`` if a page-release function has found a bad page reference or 151 unexpected page flags. This indicates a h !! 29 some unexpected page flags. 152 there should be other information in the << 153 occurred. << 154 30 155 6) ``U`` if a user or user application speci !! 31 7) ``U`` if a user or user application specifically requested that the 156 Tainted flag be set, ``' '`` otherwise. 32 Tainted flag be set, ``' '`` otherwise. 157 33 158 7) ``D`` if the kernel has died recently, i. !! 34 8) ``D`` if the kernel has died recently, i.e. there was an OOPS or BUG. 159 35 160 8) ``A`` if an ACPI table has been overridde !! 36 9) ``A`` if the ACPI table has been overridden. 161 37 162 9) ``W`` if a warning has previously been is !! 38 10) ``W`` if a warning has previously been issued by the kernel. 163 (Though some warnings may set more specif 39 (Though some warnings may set more specific taint flags.) 164 40 165 10) ``C`` if a staging driver has been loaded !! 41 11) ``C`` if a staging driver has been loaded. 166 42 167 11) ``I`` if the kernel is working around a s !! 43 12) ``I`` if the kernel is working around a severe bug in the platform 168 firmware (BIOS or similar). 44 firmware (BIOS or similar). 169 45 170 12) ``O`` if an externally-built ("out-of-tre !! 46 13) ``O`` if an externally-built ("out-of-tree") module has been loaded. 171 47 172 13) ``E`` if an unsigned module has been load !! 48 14) ``E`` if an unsigned module has been loaded in a kernel supporting 173 module signature. 49 module signature. 174 50 175 14) ``L`` if a soft lockup has previously occ !! 51 15) ``L`` if a soft lockup has previously occurred on the system. 176 << 177 15) ``K`` if the kernel has been live patched << 178 52 179 16) ``X`` Auxiliary taint, defined for and us !! 53 16) ``K`` if the kernel has been live patched. 180 54 181 17) ``T`` Kernel was build with the randstruc !! 55 The primary reason for the **'Tainted: '** string is to tell kernel 182 produce extremely unusual kernel structur !! 56 debuggers if this is a clean kernel or if anything unusual has 183 pathological ones), which is important to !! 57 occurred. Tainting is permanent: even if an offending module is 184 build time. !! 58 unloaded, the tainted value remains to indicate that the kernel is not >> 59 trustworthy.
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.