Skip to contentSkip to conversation

module-panic-taint-the-kernel-when-selftest-modules-load.patch removed from -mm tree

merged Andrew Morton 1 participant 1 message Jul 13, 2022

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: module: panic: taint the kernel when selftest modules load
has been removed from the -mm tree. Its filename was
module-panic-taint-the-kernel-when-selftest-modules-load.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: David Gow <[email protected]>
Subject: module: panic: taint the kernel when selftest modules load
Date: Fri, 8 Jul 2022 12:48:45 +0800

Taint the kernel with TAINT_TEST whenever a test module loads, by adding a new "TEST" module property, and setting it for all modules in the tools/testing directory. This property can also be set manually, for tests which live outside the tools/testing directory with:
MODULE_INFO(test, "Y");

Cc Andy Shevchenko <[email protected]>
Cc Daniel Latypov <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
Cc Guilherme G. Piccoli <[email protected]>
Cc Jani Nikula <[email protected]>
Cc John Ogness <[email protected]>
Cc Jonathan Corbet <[email protected]>
Cc Kees Cook <[email protected]>
Cc Lucas De Marchi <[email protected]>
Cc Masahiro Yamada <[email protected]>
Cc Michal Marek <[email protected]>
Cc Nathan Chancellor <[email protected]>
Cc Nick Desaulniers <[email protected]>
Cc Sebastian Reichel <[email protected]>
Cc Shuah Khan <[email protected]>

---

 kernel/module/main.c  |    7 +++++++
 scripts/mod/modpost.c |    3 +++
 2 files changed, 10 insertions(+)
kernel/module/main.c renamed from kernel/module/main.c~module-panic-taint-the-kernel-when-selftest-modules-load +7 -0
@@ -1988,6 +1988,13 @@ static int check_modinfo(struct module *
 	/* Set up license info based on the info section */
 	set_license(mod, get_modinfo(info, "license"));
 
+	if (get_modinfo(info, "test")) {
+		if (!test_taint(TAINT_TEST))
+			pr_warn("%s: loading test module taints kernel.\n",
+				mod->name);
+		add_taint_module(mod, TAINT_TEST, LOCKDEP_STILL_OK);
+	}
+
 	return 0;
 }
 
scripts/mod/modpost.c renamed from scripts/mod/modpost.c~module-panic-taint-the-kernel-when-selftest-modules-load +3 -0
@@ -2191,6 +2191,9 @@ static void add_header(struct buffer *b,
 
 	if (strstarts(mod->name, "drivers/staging"))
 		buf_printf(b, "\nMODULE_INFO(staging, \"Y\");\n");
+
+	if (strstarts(mod->name, "tools/testing"))
+		buf_printf(b, "\nMODULE_INFO(test, \"Y\");\n");
 }
 
 static void add_exported_symbols(struct buffer *buf, struct module *mod)

_

Patches currently in -mm which might be from [email protected] are

kunit-taint-the-kernel-when-kunit-tests-are-run.patch selftest-taint-kernel-when-test-module-loaded.patch