Re: [PATCH] selinux-testsuite: Add kernel module tests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/13/19 11:14 AM, Richard Haines wrote:
Test kernel module loading permissions.

Signed-off-by: Richard Haines <richard_c_haines@xxxxxxxxxxxxxx>
---
<snip>
diff --git a/tests/module_load/setestsuite_module.c b/tests/module_load/setestsuite_module.c
new file mode 100644
index 0000000..1f6be02
--- /dev/null
+++ b/tests/module_load/setestsuite_module.c
@@ -0,0 +1,22 @@
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+
+static int __init setestsuite_module_init(void)
+{
+	int result = 0;
+
+	pr_info("INIT - setestsuite_module\n");
+	result = request_module_nowait("dummy-module");
+	pr_info("request_module() returned: %d\n", result);
+	return result;
+}
+
+static void __exit setestsuite_module_exit(void)
+{
+	pr_info("EXIT - setestsuite_module\n");
+}
+
+module_init(setestsuite_module_init);
+module_exit(setestsuite_module_exit);
+MODULE_LICENSE("GPL");

Hmm...with this approach, we can't distinguish a permission denial on the module_load versus one on the module_request, right? Would it be better to have a separate no-op kernel module that always returns 0 for testing module_load and only use this one for testing module_request?



[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux