[LTP] [PATCH 1/2] tst_taint: Add TST_TAINT_N

Petr Vorel pvorel@suse.cz
Tue Jun 18 12:31:16 CEST 2024


Added in kernel v6.0-rc1, commit 2852ca7fba9f7 ("panic: Taint kernel if
tests are run").

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 include/tst_taint.h | 1 +
 lib/tst_taint.c     | 6 +++++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/tst_taint.h b/include/tst_taint.h
index bd8076c1c..b2b201688 100644
--- a/include/tst_taint.h
+++ b/include/tst_taint.h
@@ -64,6 +64,7 @@
 #define TST_TAINT_K     (1 << 15) /* kernel has been live-patched */
 #define TST_TAINT_X     (1 << 16) /* auxiliary taint, for distro's use */
 #define TST_TAINT_T     (1 << 17) /* kernel was built with the struct randomization plugin */
+#define TST_TAINT_N     (1 << 18) /* an in-kernel test has been run */
 
 /*
  * Initialize and prepare support for checking tainted kernel. Called
diff --git a/lib/tst_taint.c b/lib/tst_taint.c
index 58b96f6eb..f28932609 100644
--- a/lib/tst_taint.c
+++ b/lib/tst_taint.c
@@ -33,6 +33,7 @@ static const char *const taint_strings[] = {
 	"K (Live patched)",
 	"X (Auxilary)",
 	"T (Built with struct randomization)",
+	"N (In-kernel test has been run)",
 };
 
 static unsigned int tst_taint_read(void)
@@ -50,7 +51,10 @@ static int tst_taint_check_kver(unsigned int mask)
 	int r2;
 	int r3 = 0;
 
-	if (mask & TST_TAINT_X) {
+	if (mask & TST_TAINT_N) {
+		r1 = 6;
+		r2 = 0;
+	} else if (mask & TST_TAINT_X) {
 		r1 = 4;
 		r2 = 15;
 	} else if (mask & TST_TAINT_K) {
-- 
2.45.1



More information about the ltp mailing list