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

taint: Add TAINT_FWCTL

Requesting a fwctl scope of access that includes mutating device debug
data will cause the kernel to be tainted. Changing the device operation
through things in the debug scope may cause the device to malfunction in
undefined ways. This should be reflected in the TAINT flags to help any
debuggers understand that something has been done.

Link: https://patch.msgid.link/r/4-v5-642aa0c94070+4447f-fwctl_jgg@nvidia.com
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Shannon Nelson <shannon.nelson@amd.com>
Tested-by: Dave Jiang <dave.jiang@intel.com>
Tested-by: Shannon Nelson <shannon.nelson@amd.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>

+16 -1
+5
Documentation/admin-guide/tainted-kernels.rst
··· 101 101 16 _/X 65536 auxiliary taint, defined for and used by distros 102 102 17 _/T 131072 kernel was built with the struct randomization plugin 103 103 18 _/N 262144 an in-kernel test has been run 104 + 19 _/J 524288 userspace used a mutating debug operation in fwctl 104 105 === === ====== ======================================================== 105 106 106 107 Note: The character ``_`` is representing a blank in this table to make reading ··· 185 184 build time. 186 185 187 186 18) ``N`` if an in-kernel test, such as a KUnit test, has been run. 187 + 188 + 19) ``J`` if userpace opened /dev/fwctl/* and performed a FWTCL_RPC_DEBUG_WRITE 189 + to use the devices debugging features. Device debugging features could 190 + cause the device to malfunction in undefined ways.
+2 -1
include/linux/panic.h
··· 74 74 #define TAINT_AUX 16 75 75 #define TAINT_RANDSTRUCT 17 76 76 #define TAINT_TEST 18 77 - #define TAINT_FLAGS_COUNT 19 77 + #define TAINT_FWCTL 19 78 + #define TAINT_FLAGS_COUNT 20 78 79 #define TAINT_FLAGS_MAX ((1UL << TAINT_FLAGS_COUNT) - 1) 79 80 80 81 struct taint_flag {
+1
kernel/panic.c
··· 511 511 TAINT_FLAG(AUX, 'X', ' ', true), 512 512 TAINT_FLAG(RANDSTRUCT, 'T', ' ', true), 513 513 TAINT_FLAG(TEST, 'N', ' ', true), 514 + TAINT_FLAG(FWCTL, 'J', ' ', true), 514 515 }; 515 516 516 517 #undef TAINT_FLAG
+8
tools/debugging/kernel-chktaint
··· 204 204 echo " * an in-kernel test (such as a KUnit test) has been run (#18)" 205 205 fi 206 206 207 + T=`expr $T / 2` 208 + if [ `expr $T % 2` -eq 0 ]; then 209 + addout " " 210 + else 211 + addout "J" 212 + echo " * fwctl's mutating debug interface was used (#19)" 213 + fi 214 + 207 215 echo "For a more detailed explanation of the various taint flags see" 208 216 echo " Documentation/admin-guide/tainted-kernels.rst in the Linux kernel sources" 209 217 echo " or https://kernel.org/doc/html/latest/admin-guide/tainted-kernels.html"