What Does Tainted Flags Mean in Oops Messages

2 minute read

[ 81.890105] CPU: 3 PID: 890 Comm: insmod Tainted: G           O      4.19.108-v8+ #1

Most of the oops or panic messages contain Tainted, this indicates that the kernel has been tainted, there are several reasons, such as proprietary modules, external build modules has been loaded, kernel has a list about these taints, and specifies a letter for each bit. The table below was taken from Tainted kernels with minor modifications:

G All modules loaded have a GPL or compatible license, P if any proprietary module has been loaded. Modules without a MODULE_LICENSE or with a MODULE_LICENSE that is not recognised by insmod as GPL compatible are assumed to be proprietary.
F Any module was force loaded by insmod -f
S the oops occurred on an SMP kernel running on hardware that hasn’t been certified as safe to run multiprocessor. Currently this occurs only on various Athlons that are not SMP capable.
R A module was force unloaded by rmmod -f
M Any processor has reported a Machine Check Exception
B A page-release function has found a bad page reference or some unexpected page flags.
U A user or user application specifically requested that the Tainted flag be set.
D The kernel has died recently, i.e. there was an OOPS or BUG.
A The ACPI table has been overridden.
W A warning has previously been issued by the kernel. (Though some warnings may set more specific taint flags.)
C A staging driver has been loaded.
I The kernel is working around a severe bug in the platform firmware (BIOS or similar).
O An externally-built (“out-of-tree”) module has been loaded.
E An unsigned module has been loaded in a kernel supporting module signature.
L A soft lockup has previously occurred on the system.
K The kernel has been live patched.

The tainted states were record in /proc/sys/kernel/tainted, even if the offending module is being unloded, and was cleared on reboot.

Checking the tainted value, I got a value: 4224, what does this mean, the latest kernel doc tells more about this, for this case, 4224 = 4096(O) + 128(D), you may noticed that G is not counted, yes, it is true, only count this bit if it is a proprietary module. You can also decode tainted value with script:

$ bash /tmp/chktaint.sh 4224
Kernel is "tainted" for the following reasons:
 * kernel died recently, i.e. there was an OOPS or BUG (#7)
 * externally-built ('out-of-tree') module was loaded  (#12)
For a more detailed explanation of the various taint flags see
 Documentation/admin-guide/tainted-kernels.rst in the the Linux kernel sources
 or https://kernel.org/doc/html/latest/admin-guide/tainted-kernels.html
Raw taint value as int/string: 4224/'G      D    O     '