Linux kernel taint mechanism

What is kernel taint mechanism?
  • The Linux kernel maintains a "taint state" which is included in kernel error messages. 
  • The taint state provides an indication whether something has happened to the running kernel that affects whether a kernel error or hang.
  • It can be used to troubleshot effectively by analyzing the kernel source code. 
As an example, the taint state is set when a machine check exception (MCE) has been raised, indicating a hardware related problem has occurred. Once the taint state of a running kernel has been set, it cannot be unset other than by reloading the kernel, that is by shutting down and then restarting the system.


Taint flags

The taint status of the kernel not only indicates whether or not the kernel has been tainted but also indicates what type of event caused the kernel to be marked as tainted. This information is encoded through single-character flags in the string following "Tainted:" in a kernel error message.
  • P: A module with a Proprietary license has been loaded, i.e. a module that is not licensed under the GNU General Public License (GPL) or a compatible license. This may indicate that source code for this module is not available to the Linux kernel developers or to Novell's developers.
  • G: The opposite of 'P': the kernel has been tainted (for a reason indicated by a different flag), but all modules loaded into it were licensed under the GPL or a license compatible with the GPL.
  • F: A module was loaded using the Force option "-f" of insmod or modprobe, which caused a sanity check of the versioning information from the module (if present) to be skipped.
  • R: A module which was in use or was not designed to be removed has been forcefully Removed from the running kernelusing the force option "-f" of rmmod.
  • S: The Linux kernel is running with Symmetric MultiProcessor support (SMP), but the CPUs in the system are not designed or certified for SMP use.
  • M: A Machine Check Exception (MCE) has been raised while the kernel was running. MCEs are triggered by the hardware to indicate a hardware related problem, for example the CPU's temperature exceeding a treshold or a memory bank signaling an uncorrectable error.
  • B: A process has been found in a Bad page state, indicating a corruption of the virtual memory subsystem, possibly caused by malfunctioning RAM or cache memory.
The taint flags above are implemented in the standard Linux kernel and indicate the information provided in kernel error messages is not necessarily to be trusted.

In SUSE kernels, additional taint flags are implemented.
  • U: An Unsupported module has been loaded, i.e. a module which is not supported by Novell and which is not known to be supported by a third party. For example, the module is a driver that is not yet mature enough to be supportable or is a driver for an obsolete type of hardware which can no longer be tested adequately.
  • X: A module that is not supported by Novell but that is supported eXternally by a third party has been loaded into the kernel.

Determining the taint status of a running kernel

The taint status of a running kernel can be determined by running

#cat /proc/sys/kernel/tainted

When the output is 0, the kernel is not tainted. When the output is non-zero, the kernel is tainted. The value will be a combined number of all applying kernel taint flags added (ORed) together. You can find a list of currently used kernel flags under:
#cat /usr/src/linux/Documentation/sysctl/kernel.txt

When the kernel produces an error, a string detailing the taint status will be included.

Source: Novell

Share this

Related Posts

Previous
Next Post »

What do you think about this Article? Add your Opinion..! EmoticonEmoticon