Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'thorsten' into docs-next

+379 -60
+131 -26
Documentation/admin-guide/tainted-kernels.rst
··· 1 1 Tainted kernels 2 2 --------------- 3 3 4 - Some oops reports contain the string **'Tainted: '** after the program 5 - counter. This indicates that the kernel has been tainted by some 6 - mechanism. The string is followed by a series of position-sensitive 7 - characters, each representing a particular tainted value. 4 + The kernel will mark itself as 'tainted' when something occurs that might be 5 + relevant later when investigating problems. Don't worry too much about this, 6 + most of the time it's not a problem to run a tainted kernel; the information is 7 + mainly of interest once someone wants to investigate some problem, as its real 8 + cause might be the event that got the kernel tainted. That's why bug reports 9 + from tainted kernels will often be ignored by developers, hence try to reproduce 10 + problems with an untainted kernel. 8 11 9 - 1) ``G`` if all modules loaded have a GPL or compatible license, ``P`` if 12 + Note the kernel will remain tainted even after you undo what caused the taint 13 + (i.e. unload a proprietary kernel module), to indicate the kernel remains not 14 + trustworthy. That's also why the kernel will print the tainted state when it 15 + notices an internal problem (a 'kernel bug'), a recoverable error 16 + ('kernel oops') or a non-recoverable error ('kernel panic') and writes debug 17 + information about this to the logs ``dmesg`` outputs. It's also possible to 18 + check the tainted state at runtime through a file in ``/proc/``. 19 + 20 + 21 + Tainted flag in bugs, oops or panics messages 22 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 23 + 24 + You find the tainted state near the top in a line starting with 'CPU:'; if or 25 + why the kernel was tainted is shown after the Process ID ('PID:') and a shortened 26 + name of the command ('Comm:') that triggered the event:: 27 + 28 + BUG: unable to handle kernel NULL pointer dereference at 0000000000000000 29 + Oops: 0002 [#1] SMP PTI 30 + CPU: 0 PID: 4424 Comm: insmod Tainted: P W O 4.20.0-0.rc6.fc30 #1 31 + Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011 32 + RIP: 0010:my_oops_init+0x13/0x1000 [kpanic] 33 + [...] 34 + 35 + You'll find a 'Not tainted: ' there if the kernel was not tainted at the 36 + time of the event; if it was, then it will print 'Tainted: ' and characters 37 + either letters or blanks. In above example it looks like this:: 38 + 39 + Tainted: P W O 40 + 41 + The meaning of those characters is explained in the table below. In tis case 42 + the kernel got tainted earlier because a proprietary Module (``P``) was loaded, 43 + a warning occurred (``W``), and an externally-built module was loaded (``O``). 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 reading 51 + ``cat /proc/sys/kernel/tainted``. If that returns ``0``, the kernel is not 52 + tainted; any other number indicates the reasons why it is. The easiest way to 53 + decode that number is the script ``tools/debugging/kernel-chktaint``, which your 54 + distribution might ship as part of a package called ``linux-tools`` or 55 + ``kernel-tools``; if it doesn't you can download the script from 56 + `git.kernel.org <https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/tools/debugging/kernel-chktaint>`_ 57 + and execute it with ``sh kernel-chktaint``, which would print something like 58 + this on the machine that had the statements in the logs that were quoted earlier:: 59 + 60 + Kernel is Tainted for following reasons: 61 + * Proprietary module was loaded (#0) 62 + * Kernel issued warning (#9) 63 + * Externally-built ('out-of-tree') module was loaded (#12) 64 + See Documentation/admin-guide/tainted-kernels.rst in the the Linux kernel or 65 + https://www.kernel.org/doc/html/latest/admin-guide/tainted-kernels.html for 66 + a more details explanation of the various taint flags. 67 + Raw taint value as int/string: 4609/'P W O ' 68 + 69 + You can try to decode the number yourself. That's easy if there was only one 70 + reason that got your kernel tainted, as in this case you can find the number 71 + with the table below. If there were multiple reasons you need to decode the 72 + number, as it is a bitfield, where each bit indicates the absence or presence of 73 + a particular type of taint. It's best to leave that to the aforementioned 74 + script, but if you need something quick you can use this shell command to check 75 + which bits are set:: 76 + 77 + $ for i in $(seq 18); do echo $(($i-1)) $(($(cat /proc/sys/kernel/tainted)>>($i-1)&1));done 78 + 79 + Table for decoding tainted state 80 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 81 + 82 + === === ====== ======================================================== 83 + Bit Log Number Reason that got the kernel tainted 84 + === === ====== ======================================================== 85 + 0 G/P 1 proprietary module was loaded 86 + 1 _/F 2 module was force loaded 87 + 2 _/S 4 SMP kernel oops on an officially SMP incapable processor 88 + 3 _/R 8 module was force unloaded 89 + 4 _/M 16 processor reported a Machine Check Exception (MCE) 90 + 5 _/B 32 bad page referenced or some unexpected page flags 91 + 6 _/U 64 taint requested by userspace application 92 + 7 _/D 128 kernel died recently, i.e. there was an OOPS or BUG 93 + 8 _/A 256 ACPI table overridden by user 94 + 9 _/W 512 kernel issued warning 95 + 10 _/C 1024 staging driver was loaded 96 + 11 _/I 2048 workaround for bug in platform firmware applied 97 + 12 _/O 4096 externally-built ("out-of-tree") module was loaded 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 and used by distros 102 + 17 _/T 131072 kernel was built with the struct randomization plugin 103 + === === ====== ======================================================== 104 + 105 + Note: The character ``_`` is representing a blank in this table to make reading 106 + easier. 107 + 108 + More detailed explanation for tainting 109 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 110 + 111 + 0) ``G`` if all modules loaded have a GPL or compatible license, ``P`` if 10 112 any proprietary module has been loaded. Modules without a 11 113 MODULE_LICENSE or with a MODULE_LICENSE that is not recognised by 12 114 insmod as GPL compatible are assumed to be proprietary. 13 115 14 - 2) ``F`` if any module was force loaded by ``insmod -f``, ``' '`` if all 116 + 1) ``F`` if any module was force loaded by ``insmod -f``, ``' '`` if all 15 117 modules were loaded normally. 16 118 17 - 3) ``S`` if the oops occurred on an SMP kernel running on hardware that 119 + 2) ``S`` if the oops occurred on an SMP kernel running on hardware that 18 120 hasn't been certified as safe to run multiprocessor. 19 121 Currently this occurs only on various Athlons that are not 20 122 SMP capable. 21 123 22 - 4) ``R`` if a module was force unloaded by ``rmmod -f``, ``' '`` if all 124 + 3) ``R`` if a module was force unloaded by ``rmmod -f``, ``' '`` if all 23 125 modules were unloaded normally. 24 126 25 - 5) ``M`` if any processor has reported a Machine Check Exception, 127 + 4) ``M`` if any processor has reported a Machine Check Exception, 26 128 ``' '`` if no Machine Check Exceptions have occurred. 27 129 28 - 6) ``B`` if a page-release function has found a bad page reference or 29 - some unexpected page flags. 130 + 5) ``B`` If a page-release function has found a bad page reference or some 131 + unexpected page flags. This indicates a hardware problem or a kernel bug; 132 + there should be other information in the log indicating why this tainting 133 + occured. 30 134 31 - 7) ``U`` if a user or user application specifically requested that the 135 + 6) ``U`` if a user or user application specifically requested that the 32 136 Tainted flag be set, ``' '`` otherwise. 33 137 34 - 8) ``D`` if the kernel has died recently, i.e. there was an OOPS or BUG. 138 + 7) ``D`` if the kernel has died recently, i.e. there was an OOPS or BUG. 35 139 36 - 9) ``A`` if the ACPI table has been overridden. 140 + 8) ``A`` if an ACPI table has been overridden. 37 141 38 - 10) ``W`` if a warning has previously been issued by the kernel. 142 + 9) ``W`` if a warning has previously been issued by the kernel. 39 143 (Though some warnings may set more specific taint flags.) 40 144 41 - 11) ``C`` if a staging driver has been loaded. 145 + 10) ``C`` if a staging driver has been loaded. 42 146 43 - 12) ``I`` if the kernel is working around a severe bug in the platform 147 + 11) ``I`` if the kernel is working around a severe bug in the platform 44 148 firmware (BIOS or similar). 45 149 46 - 13) ``O`` if an externally-built ("out-of-tree") module has been loaded. 150 + 12) ``O`` if an externally-built ("out-of-tree") module has been loaded. 47 151 48 - 14) ``E`` if an unsigned module has been loaded in a kernel supporting 152 + 13) ``E`` if an unsigned module has been loaded in a kernel supporting 49 153 module signature. 50 154 51 - 15) ``L`` if a soft lockup has previously occurred on the system. 155 + 14) ``L`` if a soft lockup has previously occurred on the system. 52 156 53 - 16) ``K`` if the kernel has been live patched. 157 + 15) ``K`` if the kernel has been live patched. 54 158 55 - The primary reason for the **'Tainted: '** string is to tell kernel 56 - debuggers if this is a clean kernel or if anything unusual has 57 - occurred. Tainting is permanent: even if an offending module is 58 - unloaded, the tainted value remains to indicate that the kernel is not 59 - trustworthy. 159 + 16) ``X`` Auxiliary taint, defined for and used by Linux distributors. 160 + 161 + 17) ``T`` Kernel was build with the randstruct plugin, which can intentionally 162 + produce extremely unusual kernel structure layouts (even performance 163 + pathological ones), which is important to know when debugging. Set at 164 + build time.
+22 -28
Documentation/sysctl/kernel.txt
··· 94 94 - stop-a [ SPARC only ] 95 95 - sysrq ==> Documentation/admin-guide/sysrq.rst 96 96 - sysctl_writes_strict 97 - - tainted 97 + - tainted ==> Documentation/admin-guide/tainted-kernels.rst 98 98 - threads-max 99 99 - unknown_nmi_panic 100 100 - watchdog ··· 1019 1019 1020 1020 1: kernel stack erasing is enabled (default), it is performed before 1021 1021 returning to the userspace at the end of syscalls. 1022 - 1023 1022 ============================================================== 1024 1023 1025 - tainted: 1024 + tainted 1026 1025 1027 1026 Non-zero if the kernel has been tainted. Numeric values, which can be 1028 1027 ORed together. The letters are seen in "Tainted" line of Oops reports. 1029 1028 1030 - 1 (P): A module with a non-GPL license has been loaded, this 1031 - includes modules with no license. 1032 - Set by modutils >= 2.4.9 and module-init-tools. 1033 - 2 (F): A module was force loaded by insmod -f. 1034 - Set by modutils >= 2.4.9 and module-init-tools. 1035 - 4 (S): Unsafe SMP processors: SMP with CPUs not designed for SMP. 1036 - 8 (R): A module was forcibly unloaded from the system by rmmod -f. 1037 - 16 (M): A hardware machine check error occurred on the system. 1038 - 32 (B): A bad page was discovered on the system. 1039 - 64 (U): The user has asked that the system be marked "tainted". This 1040 - could be because they are running software that directly modifies 1041 - the hardware, or for other reasons. 1042 - 128 (D): The system has died. 1043 - 256 (A): The ACPI DSDT has been overridden with one supplied by the user 1044 - instead of using the one provided by the hardware. 1045 - 512 (W): A kernel warning has occurred. 1046 - 1024 (C): A module from drivers/staging was loaded. 1047 - 2048 (I): The system is working around a severe firmware bug. 1048 - 4096 (O): An out-of-tree module has been loaded. 1049 - 8192 (E): An unsigned module has been loaded in a kernel supporting module 1050 - signature. 1051 - 16384 (L): A soft lockup has previously occurred on the system. 1052 - 32768 (K): The kernel has been live patched. 1053 - 65536 (X): Auxiliary taint, defined and used by for distros. 1054 - 131072 (T): The kernel was built with the struct randomization plugin. 1029 + 1 (P): proprietary module was loaded 1030 + 2 (F): module was force loaded 1031 + 4 (S): SMP kernel oops on an officially SMP incapable processor 1032 + 8 (R): module was force unloaded 1033 + 16 (M): processor reported a Machine Check Exception (MCE) 1034 + 32 (B): bad page referenced or some unexpected page flags 1035 + 64 (U): taint requested by userspace application 1036 + 128 (D): kernel died recently, i.e. there was an OOPS or BUG 1037 + 256 (A): an ACPI table was overridden by user 1038 + 512 (W): kernel issued warning 1039 + 1024 (C): staging driver was loaded 1040 + 2048 (I): workaround for bug in platform firmware applied 1041 + 4096 (O): externally-built ("out-of-tree") module was loaded 1042 + 8192 (E): unsigned module was loaded 1043 + 16384 (L): soft lockup occurred 1044 + 32768 (K): kernel has been live patched 1045 + 65536 (X): Auxiliary taint, defined and used by for distros 1046 + 131072 (T): The kernel was built with the struct randomization plugin 1047 + 1048 + See Documentation/admin-guide/tainted-kernels.rst for more information. 1055 1049 1056 1050 ============================================================== 1057 1051
+8 -6
tools/Makefile
··· 12 12 @echo ' acpi - ACPI tools' 13 13 @echo ' cgroup - cgroup tools' 14 14 @echo ' cpupower - a tool for all things x86 CPU power' 15 + @echo ' debugging - tools for debugging' 15 16 @echo ' firewire - the userspace part of nosy, an IEEE-1394 traffic sniffer' 16 17 @echo ' firmware - Firmware tools' 17 18 @echo ' freefall - laptop accelerometer program for disk protection' ··· 62 61 cpupower: FORCE 63 62 $(call descend,power/$@) 64 63 65 - cgroup firewire hv guest spi usb virtio vm bpf iio gpio objtool leds wmi pci firmware: FORCE 64 + cgroup firewire hv guest spi usb virtio vm bpf iio gpio objtool leds wmi pci firmware debugging: FORCE 66 65 $(call descend,$@) 67 66 68 67 liblockdep: FORCE ··· 97 96 all: acpi cgroup cpupower gpio hv firewire liblockdep \ 98 97 perf selftests spi turbostat usb \ 99 98 virtio vm bpf x86_energy_perf_policy \ 100 - tmon freefall iio objtool kvm_stat wmi pci 99 + tmon freefall iio objtool kvm_stat wmi \ 100 + pci debugging 101 101 102 102 acpi_install: 103 103 $(call descend,power/$(@:_install=),install) ··· 106 104 cpupower_install: 107 105 $(call descend,power/$(@:_install=),install) 108 106 109 - cgroup_install firewire_install gpio_install hv_install iio_install perf_install spi_install usb_install virtio_install vm_install bpf_install objtool_install wmi_install pci_install: 107 + cgroup_install firewire_install gpio_install hv_install iio_install perf_install spi_install usb_install virtio_install vm_install bpf_install objtool_install wmi_install pci_install debugging_install: 110 108 $(call descend,$(@:_install=),install) 111 109 112 110 liblockdep_install: ··· 132 130 perf_install selftests_install turbostat_install usb_install \ 133 131 virtio_install vm_install bpf_install x86_energy_perf_policy_install \ 134 132 tmon_install freefall_install objtool_install kvm_stat_install \ 135 - wmi_install pci_install 133 + wmi_install pci_install debugging_install 136 134 137 135 acpi_clean: 138 136 $(call descend,power/acpi,clean) ··· 140 138 cpupower_clean: 141 139 $(call descend,power/cpupower,clean) 142 140 143 - cgroup_clean hv_clean firewire_clean spi_clean usb_clean virtio_clean vm_clean wmi_clean bpf_clean iio_clean gpio_clean objtool_clean leds_clean pci_clean firmware_clean: 141 + cgroup_clean hv_clean firewire_clean spi_clean usb_clean virtio_clean vm_clean wmi_clean bpf_clean iio_clean gpio_clean objtool_clean leds_clean pci_clean firmware_clean debugging_clean: 144 142 $(call descend,$(@:_clean=),clean) 145 143 146 144 liblockdep_clean: ··· 178 176 perf_clean selftests_clean turbostat_clean spi_clean usb_clean virtio_clean \ 179 177 vm_clean bpf_clean iio_clean x86_energy_perf_policy_clean tmon_clean \ 180 178 freefall_clean build_clean libbpf_clean libsubcmd_clean liblockdep_clean \ 181 - gpio_clean objtool_clean leds_clean wmi_clean pci_clean firmware_clean 179 + gpio_clean objtool_clean leds_clean wmi_clean pci_clean firmware_clean debugging_clean 182 180 183 181 .PHONY: FORCE
+16
tools/debugging/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + # Makefile for debugging tools 3 + 4 + PREFIX ?= /usr 5 + BINDIR ?= bin 6 + INSTALL ?= install 7 + 8 + TARGET = kernel-chktaint 9 + 10 + all: $(TARGET) 11 + 12 + clean: 13 + 14 + install: kernel-chktaint 15 + $(INSTALL) -D -m 755 $(TARGET) $(DESTDIR)$(PREFIX)/$(BINDIR)/$(TARGET) 16 +
+202
tools/debugging/kernel-chktaint
··· 1 + #! /bin/sh 2 + # SPDX-License-Identifier: GPL-2.0 3 + # 4 + # Randy Dunlap <rdunlap@infradead.org>, 2018 5 + # Thorsten Leemhuis <linux@leemhuis.info>, 2018 6 + 7 + usage() 8 + { 9 + cat <<EOF 10 + usage: ${0##*/} 11 + ${0##*/} <int> 12 + 13 + Call without parameters to decode /proc/sys/kernel/tainted. 14 + 15 + Call with a positive integer as parameter to decode a value you 16 + retrieved from /proc/sys/kernel/tainted on another system. 17 + 18 + EOF 19 + } 20 + 21 + if [ "$1"x != "x" ]; then 22 + if [ "$1"x == "--helpx" ] || [ "$1"x == "-hx" ] ; then 23 + usage 24 + exit 1 25 + elif [ $1 -ge 0 ] 2>/dev/null ; then 26 + taint=$1 27 + else 28 + echo "Error: Parameter '$1' not a positive interger. Aborting." >&2 29 + exit 1 30 + fi 31 + else 32 + TAINTFILE="/proc/sys/kernel/tainted" 33 + if [ ! -r $TAINTFILE ]; then 34 + echo "No file: $TAINTFILE" 35 + exit 36 + fi 37 + 38 + taint=`cat $TAINTFILE` 39 + fi 40 + 41 + if [ $taint -eq 0 ]; then 42 + echo "Kernel not Tainted" 43 + exit 44 + else 45 + echo "Kernel is \"tainted\" for the following reasons:" 46 + fi 47 + 48 + T=$taint 49 + out= 50 + 51 + addout() { 52 + out=$out$1 53 + } 54 + 55 + if [ `expr $T % 2` -eq 0 ]; then 56 + addout "G" 57 + else 58 + addout "P" 59 + echo " * proprietary module was loaded (#0)" 60 + fi 61 + 62 + T=`expr $T / 2` 63 + if [ `expr $T % 2` -eq 0 ]; then 64 + addout " " 65 + else 66 + addout "F" 67 + echo " * module was force loaded (#1)" 68 + fi 69 + 70 + T=`expr $T / 2` 71 + if [ `expr $T % 2` -eq 0 ]; then 72 + addout " " 73 + else 74 + addout "S" 75 + echo " * SMP kernel oops on an officially SMP incapable processor (#2)" 76 + fi 77 + 78 + T=`expr $T / 2` 79 + if [ `expr $T % 2` -eq 0 ]; then 80 + addout " " 81 + else 82 + addout "R" 83 + echo " * module was force unloaded (#3)" 84 + fi 85 + 86 + T=`expr $T / 2` 87 + if [ `expr $T % 2` -eq 0 ]; then 88 + addout " " 89 + else 90 + addout "M" 91 + echo " * processor reported a Machine Check Exception (MCE) (#4)" 92 + fi 93 + 94 + T=`expr $T / 2` 95 + if [ `expr $T % 2` -eq 0 ]; then 96 + addout " " 97 + else 98 + addout "B" 99 + echo " * bad page referenced or some unexpected page flags (#5)" 100 + fi 101 + 102 + T=`expr $T / 2` 103 + if [ `expr $T % 2` -eq 0 ]; then 104 + addout " " 105 + else 106 + addout "U" 107 + echo " * taint requested by userspace application (#6)" 108 + fi 109 + 110 + T=`expr $T / 2` 111 + if [ `expr $T % 2` -eq 0 ]; then 112 + addout " " 113 + else 114 + addout "D" 115 + echo " * kernel died recently, i.e. there was an OOPS or BUG (#7)" 116 + fi 117 + 118 + T=`expr $T / 2` 119 + if [ `expr $T % 2` -eq 0 ]; then 120 + addout " " 121 + else 122 + addout "A" 123 + echo " * an ACPI table was overridden by user (#8)" 124 + fi 125 + 126 + T=`expr $T / 2` 127 + if [ `expr $T % 2` -eq 0 ]; then 128 + addout " " 129 + else 130 + addout "W" 131 + echo " * kernel issued warning (#9)" 132 + fi 133 + 134 + T=`expr $T / 2` 135 + if [ `expr $T % 2` -eq 0 ]; then 136 + addout " " 137 + else 138 + addout "C" 139 + echo " * staging driver was loaded (#10)" 140 + fi 141 + 142 + T=`expr $T / 2` 143 + if [ `expr $T % 2` -eq 0 ]; then 144 + addout " " 145 + else 146 + addout "I" 147 + echo " * workaround for bug in platform firmware applied (#11)" 148 + fi 149 + 150 + T=`expr $T / 2` 151 + if [ `expr $T % 2` -eq 0 ]; then 152 + addout " " 153 + else 154 + addout "O" 155 + echo " * externally-built ('out-of-tree') module was loaded (#12)" 156 + fi 157 + 158 + T=`expr $T / 2` 159 + if [ `expr $T % 2` -eq 0 ]; then 160 + addout " " 161 + else 162 + addout "E" 163 + echo " * unsigned module was loaded (#13)" 164 + fi 165 + 166 + T=`expr $T / 2` 167 + if [ `expr $T % 2` -eq 0 ]; then 168 + addout " " 169 + else 170 + addout "L" 171 + echo " * soft lockup occurred (#14)" 172 + fi 173 + 174 + T=`expr $T / 2` 175 + if [ `expr $T % 2` -eq 0 ]; then 176 + addout " " 177 + else 178 + addout "K" 179 + echo " * kernel has been live patched (#15)" 180 + fi 181 + 182 + T=`expr $T / 2` 183 + if [ `expr $T % 2` -eq 0 ]; then 184 + addout " " 185 + else 186 + addout "X" 187 + echo " * auxiliary taint, defined for and used by distros (#16)" 188 + 189 + fi 190 + T=`expr $T / 2` 191 + if [ `expr $T % 2` -eq 0 ]; then 192 + addout " " 193 + else 194 + addout "T" 195 + echo " * kernel was built with the struct randomization plugin (#17)" 196 + fi 197 + 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'" 202 + #EOF#