diff options
| author | Randy Dunlap <rdunlap@infradead.org> | 2026-01-14 22:47:56 -0800 |
|---|---|---|
| committer | Andrew Morton <akpm@linux-foundation.org> | 2026-01-26 19:07:15 -0800 |
| commit | 08e8f1ef3df270daef4ffc9c4bb15669f72d5d2f (patch) | |
| tree | 6d726c9cb549134b1b593473ab647c4406bff331 /tools/debugging | |
| parent | 89802ca36c96b324829996ef05013f82ecc9b68a (diff) | |
kernel-chktaint: add reporting for tainted modules
Check all loaded modules and report any that have their 'taint'
flags set. The tainted module output format is:
* <module_name> (<taint_flags>)
Example output:
Kernel is "tainted" for the following reasons:
* externally-built ('out-of-tree') module was loaded (#12)
* unsigned module was loaded (#13)
Raw taint value as int/string: 12288/'G OE '
Tainted modules:
* dump_test (OE)
Link: https://lkml.kernel.org/r/20260115064756.531592-1-rdunlap@infradead.org
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Thorsten Leemhuis <linux@leemhuis.info>
Cc: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'tools/debugging')
| -rwxr-xr-x | tools/debugging/kernel-chktaint | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tools/debugging/kernel-chktaint b/tools/debugging/kernel-chktaint index e7da0909d097..e1571c04afb5 100755 --- a/tools/debugging/kernel-chktaint +++ b/tools/debugging/kernel-chktaint @@ -211,9 +211,25 @@ else addout "J" echo " * fwctl's mutating debug interface was used (#19)" fi +echo "Raw taint value as int/string: $taint/'$out'" + +# report on any tainted loadable modules +[ "$1" = "" ] && [ -r /sys/module/ ] && \ + cnt=`grep [A-Z] /sys/module/*/taint | wc -l` || cnt=0 +if [ $cnt -ne 0 ]; then + echo + echo "Tainted modules:" + for dir in `ls /sys/module` ; do + if [ -r /sys/module/$dir/taint ]; then + modtnt=`cat /sys/module/$dir/taint` + [ "$modtnt" = "" ] || echo " * $dir ($modtnt)" + fi + done +fi + +echo echo "For a more detailed explanation of the various taint flags see" echo " Documentation/admin-guide/tainted-kernels.rst in the Linux kernel sources" echo " or https://kernel.org/doc/html/latest/admin-guide/tainted-kernels.html" -echo "Raw taint value as int/string: $taint/'$out'" #EOF# |
