tools: Add new "test" taint to kernel-chktaint
PATCH v2 1/1 tools: Add new "test" taint to kernel-chktaint
Commit c272612cb4a2 ("kunit: Taint the kernel when KUnit tests are run") added a new taint flag for when in-kernel tests run. This commit adds recognition of this new flag in kernel-chktaint.
---
Changes in v2:
- based off of kselftest/kunit branch
- Added David's Reviewed-by tag
tools/debugging/kernel-chktaint | 9 +++++++++ 1 file changed, 9 insertions(+)
tools/debugging/kernel-chktaint +9 -0
@@ -187,6 +187,7 @@ else echo " * auxiliary taint, defined for and used by distros (#16)" fi + T=`expr $T / 2` if [ `expr $T % 2` -eq 0 ]; then addout " "
@@ -195,6 +196,14 @@ else echo " * kernel was built with the struct randomization plugin (#17)" fi +T=`expr $T / 2` +if [ `expr $T % 2` -eq 0 ]; then + addout " " +else + addout "N" + echo " * an in-kernel test (such as a KUnit test) has been run (#18)" +fi + 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"
Signature · 1 line
2.37.1.595.g718a3a8f04-goog
Quoted 5 lines · Joe Fradley
Commit
c272612cb4a2("kunit: Taint the kernel when KUnit tests are run") added a new taint flag for when in-kernel tests run. This commit adds recognition of this new flag in kernel-chktaint.
Quoted 7 lines
Reviewed-by David Gow <[email protected]>Signed-off-by Joe Fradley <[email protected]>---
Changes in v2:
- based off of kselftest/kunit branch
- Added David's Reviewed-by tag
This still looks good to me.
Unless anyone objects, I guess we'll take this through the KUnit branch (which, after all, is where the taint was originally added). I've added it to the list for 6.1, but it technically could be considered a fix for 6.0 as well.
Cheers,
-- David
Quoted 33 lines
tools/debugging/kernel-chktaint | 9 +++++++++ 1 file changed, 9 insertions(+)tools/debugging/kernel-chktaint +9
-1@@ -187,6 +187,7 @@ else echo " * auxiliary taint, defined for and used by distros (#16)" fi + T=`expr $T / 2` if [ `expr $T % 2` -eq 0 ]; then addout " "@@ -195,6 +196,14 @@ else echo " * kernel was built with the struct randomization plugin (#17)" fi +T=`expr $T / 2` +if [ `expr $T % 2` -eq 0 ]; then + addout " " +else + addout "N" + echo " * an in-kernel test (such as a KUnit test) has been run (#18)" +fi + 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" --2.37.1.595.g718a3a8f04-goog
Shuah Khan
maintainerQuoted 6 lines · David Gow
Quoted 5 lines · Joe Fradley
Commit
c272612cb4a2("kunit: Taint the kernel when KUnit tests are run") added a new taint flag for when in-kernel tests run. This commit adds recognition of this new flag in kernel-chktaint.
What happens without this change? It isn't clear what this change is fixing.
Quoted 8 lines
Quoted 7 lines
Reviewed-by David Gow <[email protected]>Signed-off-by Joe Fradley <[email protected]>---
Changes in v2:
- based off of kselftest/kunit branch
- Added David's Reviewed-by tag
Quoted 7 lines
This still looks good to me.
Unless anyone objects, I guess we'll take this through the KUnit branch (which, after all, is where the taint was originally added). I've added it to the list for 6.1, but it technically could be considered a fix for 6.0 as well.
I can definitely take this for Linux 6.0 with additional information on the problems seen without this change.
thanks,
-- Shuah
Quoted 11 lines · Shuah Khan
Quoted 6 lines · David Gow
Quoted 5 lines · Joe Fradley
Commit
c272612cb4a2("kunit: Taint the kernel when KUnit tests are run") added a new taint flag for when in-kernel tests run. This commit adds recognition of this new flag in kernel-chktaint.What happens without this change? It isn't clear what this change is fixing.
Without this change the correct reason will not be displayed if the kernel is tainted because of a test.
Quoted 11 lines
Quoted 11 lines
Quoted 8 lines
Reviewed-by David Gow <[email protected]>Signed-off-by Joe Fradley <[email protected]>---
Changes in v2:
- based off of kselftest/kunit branch
- Added David's Reviewed-by tagThis still looks good to me.
Quoted 8 lines
Quoted 5 lines
Unless anyone objects, I guess we'll take this through the KUnit branch (which, after all, is where the taint was originally added). I've added it to the list for 6.1, but it technically could be considered a fix for 6.0 as well.
I can definitely take this for Linux 6.0 with additional information on the problems seen without this change.
Great, thank you very much.
Quoted 4 lines
thanks,
-- Shuah
Quoted 4 lines · Shuah Khan
Quoted 2 lines · David Gow
Quoted 1 line · Joe Fradley
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Commit
c272612cb4a2("kunit: Taint the kernel when KUnit tests are run") added a new taint flag for when in-kernel tests run. This commit adds recognition of this new flag in kernel-chktaint.What happens without this change? It isn't clear what this change is fixing.
Without this patch, running ./tools/debugging/kernel-chktaint against a kernel tainted due to loading/running an in-kernel test (KUnit, kselftest, etc) will not describe the reason for the taint:
Kernel is "tainted" for the following reasons:
For a more detailed explanation of the various taint flags see Documentation/admin-guide/tainted-kernels.rst in the Linux kernel sources or https://kernel.org/doc/html/latest/admin-guide/tainted-kernels.html
Raw taint value as int/string: 262144/'G '
With this change (which should've been introduced along with the new taint flag), the 'N' taint is printed correctly, along with an explanation:
Kernel is "tainted" for the following reasons:
* an in-kernel test (such as a KUnit test) has been run (#18) For a more detailed explanation of the various taint flags see Documentation/admin-guide/tainted-kernels.rst in the Linux kernel sources or https://kernel.org/doc/html/latest/admin-guide/tainted-kernels.html
Raw taint value as int/string: 262144/'G N'
Quoted 10 lines
Quoted 10 lines
Quoted 7 lines
Reviewed-by David Gow <[email protected]>Signed-off-by Joe Fradley <[email protected]>---
Changes in v2:
- based off of kselftest/kunit branch
- Added David's Reviewed-by tagThis still looks good to me.
Quoted 9 lines
Quoted 5 lines
Unless anyone objects, I guess we'll take this through the KUnit branch (which, after all, is where the taint was originally added). I've added it to the list for 6.1, but it technically could be considered a fix for 6.0 as well.
I can definitely take this for Linux 6.0 with additional information on the problems seen without this change.
Yeah, basically the output from kernel-chktaint is incomplete (and, in the case of the taint string, I'd argue wrong).
Not a disaster if this doesn't land for 6.0, but given 6.0 c an generate the new taint flag, it makes sense to decode it correctly if possible.
Cheers,
-- David
Quoted 7 lines · Joe Fradley
Commit
c272612cb4a2("kunit: Taint the kernel when KUnit tests are run") added a new taint flag for when in-kernel tests run. This commit adds recognition of this new flag in kernel-chktaint.Reviewed-by David Gow <[email protected]>Signed-off-by Joe Fradley <[email protected]>
Thanks!