From: Randy Dunlap <rdunlap@infradead.org>
To: Jonathan Corbet <corbet@lwn.net>,
Thorsten Leemhuis <linux@leemhuis.info>
Cc: linux-doc@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 0/1] RFC: Revamp admin-guide/tainted-kernels.rst to make it more comprehensible
Date: Mon, 17 Dec 2018 13:06:15 -0800 [thread overview]
Message-ID: <8f67a8ca-bf64-c537-843a-b03bcfc3dace@infradead.org> (raw)
In-Reply-To: <20181217112437.5fe868eb@lwn.net>
[-- Attachment #1: Type: text/plain, Size: 475 bytes --]
On 12/17/18 10:24 AM, Jonathan Corbet wrote:
> Here's an idea if you feel like improving this: rather than putting an
> inscrutable program inline, add a taint_status script to scripts/ that
> prints out the status in fully human-readable form, with the explanation
> for every set bit.
And some people prefer not adding tools that use python, perl, etc.
E.g., I use this shell script (named 'chktaint', which could probably
be done better):
(see attachment)
--
~Randy
[-- Attachment #2: chktaint --]
[-- Type: text/plain, Size: 2356 bytes --]
#! /bin/sh
# GPL v2.
# Randy Dunlap <rdunlap@infradead.org>
TAINTFILE="/proc/sys/kernel/tainted"
if [ ! -r $TAINTFILE ]; then
echo "No file: $TAINTFILE"
exit
fi
taint=`cat $TAINTFILE`
if [ $taint -eq 0 ]; then
echo "Kernel not Tainted"
exit
fi
echo "Raw Taint value: $taint"
T=$taint
out=
addout() {
out=$out$1
}
if [ `expr $T % 2` -eq 0 ]; then
addout "G"
else
addout "P" # Proprietary module was loaded
fi
T=`expr $T / 2`
if [ `expr $T % 2` -eq 0 ]; then
addout " "
else
addout "F" # module was force loaded
fi
T=`expr $T / 2`
if [ `expr $T % 2` -eq 0 ]; then
addout " "
else
addout "S" # oops on non-supported SMP hardware
fi
T=`expr $T / 2`
if [ `expr $T % 2` -eq 0 ]; then
addout " "
else
addout "R" # module was force unloaded
fi
T=`expr $T / 2`
if [ `expr $T % 2` -eq 0 ]; then
addout " "
else
addout "M" # Machine Check exception
fi
T=`expr $T / 2`
if [ `expr $T % 2` -eq 0 ]; then
addout " "
else
addout "B" # Bad Page reference
fi
T=`expr $T / 2`
if [ `expr $T % 2` -eq 0 ]; then
addout " "
else
addout "U" # User taint requested
fi
T=`expr $T / 2`
if [ `expr $T % 2` -eq 0 ]; then
addout " "
else
addout "D" # kernel Died, Oops, or Bug
fi
T=`expr $T / 2`
if [ `expr $T % 2` -eq 0 ]; then
addout " "
else
addout "A" # ACPI table overridden
fi
T=`expr $T / 2`
if [ `expr $T % 2` -eq 0 ]; then
addout " "
else
addout "W" # previous Warning was issued
fi
T=`expr $T / 2`
if [ `expr $T % 2` -eq 0 ]; then
addout " "
else
addout "C" # Staging (Crap) module was loaded
fi
T=`expr $T / 2`
if [ `expr $T % 2` -eq 0 ]; then
addout " "
else
addout "I" # firmware bug workaround
fi
T=`expr $T / 2`
if [ `expr $T % 2` -eq 0 ]; then
addout " "
else
addout "O" # out-of-tree module loaded
fi
T=`expr $T / 2`
if [ `expr $T % 2` -eq 0 ]; then
addout " "
else
addout "E" # unsigned module loaded in kernel with signing
fi
T=`expr $T / 2`
if [ `expr $T % 2` -eq 0 ]; then
addout " "
else
addout "L" # soft lockup reported
fi
T=`expr $T / 2`
if [ `expr $T % 2` -eq 0 ]; then
addout " "
else
addout "K" # kernel has been live-patched
fi
T=`expr $T / 2`
if [ `expr $T % 2` -eq 0 ]; then
addout " "
else
addout "X" # auxiliary taint, used by distros
fi
T=`expr $T / 2`
if [ `expr $T % 2` -eq 0 ]; then
addout " "
else
addout "T" # struct randomization plugin was used
fi
echo "Kernel Taint: $out"
#EOF#
next prev parent reply other threads:[~2018-12-17 21:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-17 15:20 [PATCH 0/1] RFC: Revamp admin-guide/tainted-kernels.rst to make it more comprehensible Thorsten Leemhuis
2018-12-17 15:20 ` [PATCH 1/1] docs: Revamp tainted-kernels.rst " Thorsten Leemhuis
2018-12-17 21:14 ` Randy Dunlap
2018-12-17 18:24 ` [PATCH 0/1] RFC: Revamp admin-guide/tainted-kernels.rst " Jonathan Corbet
2018-12-17 21:06 ` Randy Dunlap [this message]
2018-12-20 15:23 ` Thorsten Leemhuis
2018-12-20 15:28 ` Jonathan Corbet
2018-12-20 16:38 ` Randy Dunlap
2018-12-20 18:21 ` Thorsten Leemhuis
2018-12-20 20:10 ` Randy Dunlap
2018-12-21 12:31 ` Thorsten Leemhuis
2018-12-20 16:42 ` Randy Dunlap
2018-12-21 15:26 ` Thorsten Leemhuis
2019-01-03 9:32 ` Thorsten Leemhuis
2019-01-03 18:12 ` Jonathan Corbet
2019-01-07 18:56 ` Thorsten Leemhuis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8f67a8ca-bf64-c537-843a-b03bcfc3dace@infradead.org \
--to=rdunlap@infradead.org \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@leemhuis.info \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.