2 # SPDX-License-Identifier: GPL-2.0
4 # Randy Dunlap <rdunlap@infradead.org>, 2018
5 # Thorsten Leemhuis <linux@leemhuis.info>, 2018
13 Call without parameters to decode /proc/sys/kernel/tainted.
15 Call with a positive integer as parameter to decode a value you
16 retrieved from /proc/sys/kernel/tainted on another system.
21 if [ "$1"x
!= "x" ]; then
22 if [ "$1"x
== "--helpx" ] ||
[ "$1"x
== "-hx" ] ; then
25 elif [ $1 -ge 0 ] 2>/dev
/null
; then
28 echo "Error: Parameter '$1' not a positive interger. Aborting." >&2
32 TAINTFILE
="/proc/sys/kernel/tainted"
33 if [ ! -r $TAINTFILE ]; then
34 echo "No file: $TAINTFILE"
38 taint
=`cat $TAINTFILE`
41 if [ $taint -eq 0 ]; then
42 echo "Kernel not Tainted"
45 echo "Kernel is \"tainted\" for the following reasons:"
55 if [ `expr $T % 2` -eq 0 ]; then
59 echo " * proprietary module was loaded (#0)"
63 if [ `expr $T % 2` -eq 0 ]; then
67 echo " * module was force loaded (#1)"
71 if [ `expr $T % 2` -eq 0 ]; then
75 echo " * SMP kernel oops on an officially SMP incapable processor (#2)"
79 if [ `expr $T % 2` -eq 0 ]; then
83 echo " * module was force unloaded (#3)"
87 if [ `expr $T % 2` -eq 0 ]; then
91 echo " * processor reported a Machine Check Exception (MCE) (#4)"
95 if [ `expr $T % 2` -eq 0 ]; then
99 echo " * bad page referenced or some unexpected page flags (#5)"
103 if [ `expr $T % 2` -eq 0 ]; then
107 echo " * taint requested by userspace application (#6)"
111 if [ `expr $T % 2` -eq 0 ]; then
115 echo " * kernel died recently, i.e. there was an OOPS or BUG (#7)"
119 if [ `expr $T % 2` -eq 0 ]; then
123 echo " * an ACPI table was overridden by user (#8)"
127 if [ `expr $T % 2` -eq 0 ]; then
131 echo " * kernel issued warning (#9)"
135 if [ `expr $T % 2` -eq 0 ]; then
139 echo " * staging driver was loaded (#10)"
143 if [ `expr $T % 2` -eq 0 ]; then
147 echo " * workaround for bug in platform firmware applied (#11)"
151 if [ `expr $T % 2` -eq 0 ]; then
155 echo " * externally-built ('out-of-tree') module was loaded (#12)"
159 if [ `expr $T % 2` -eq 0 ]; then
163 echo " * unsigned module was loaded (#13)"
167 if [ `expr $T % 2` -eq 0 ]; then
171 echo " * soft lockup occurred (#14)"
175 if [ `expr $T % 2` -eq 0 ]; then
179 echo " * kernel has been live patched (#15)"
183 if [ `expr $T % 2` -eq 0 ]; then
187 echo " * auxiliary taint, defined for and used by distros (#16)"
191 if [ `expr $T % 2` -eq 0 ]; then
195 echo " * kernel was built with the struct randomization plugin (#17)"
198 echo "For a more detailed explanation of the various taint flags see"
199 echo " Documentation/admin-guide/tainted-kernels.rst in the the Linux kernel sources"
200 echo " or https://kernel.org/doc/html/latest/admin-guide/tainted-kernels.html"
201 echo "Raw taint value as int/string: $taint/'$out'"