]> xenbits.xensource.com Git - people/aperard/linux-chromebook.git/commitdiff
CHROMIUM: add test_module module
authorKees Cook <keescook@chromium.org>
Tue, 18 Dec 2012 23:17:56 +0000 (15:17 -0800)
committerGerrit <chrome-bot@google.com>
Thu, 20 Dec 2012 19:22:55 +0000 (11:22 -0800)
Create a module for simple module loading tests.

BUG=chromium-os:37353
TEST=daisy build, security_ModuleLocking passes when using "test_module"

Change-Id: I7ac604b614d69c2f18266a2241a660629b418701
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39918
Reviewed-by: Grant Grundler <grundler@chromium.org>
Tested-by: Grant Grundler <grundler@chromium.org>
kernel/Makefile
kernel/test_module.c [new file with mode: 0644]
lib/Kconfig.debug

index cb41b9547c9f082b4978ef425771b6b0c38c57a6..b5648b1ca3601c0c011777aec49a2e92bb242550 100644 (file)
@@ -51,6 +51,7 @@ obj-$(CONFIG_DEBUG_SPINLOCK) += spinlock.o
 obj-$(CONFIG_PROVE_LOCKING) += spinlock.o
 obj-$(CONFIG_UID16) += uid16.o
 obj-$(CONFIG_MODULES) += module.o
+obj-$(CONFIG_TEST_MODULE) += test_module.o
 obj-$(CONFIG_KALLSYMS) += kallsyms.o
 obj-$(CONFIG_BSD_PROCESS_ACCT) += acct.o
 obj-$(CONFIG_KEXEC) += kexec.o
diff --git a/kernel/test_module.c b/kernel/test_module.c
new file mode 100644 (file)
index 0000000..f825589
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * "hello world" kernel module
+ */
+
+#define pr_fmt(fmt) "test_module: " fmt
+
+#include <linux/module.h>
+
+static int __init test_module_init(void)
+{
+       pr_info("Hello, world\n");
+
+       return 0;
+}
+
+module_init(test_module_init);
+
+static void __exit test_module_exit(void)
+{
+       pr_info("Goodbye\n");
+}
+
+module_exit(test_module_exit);
+
+MODULE_AUTHOR("Kees Cook <keescook@chromium.org>");
+MODULE_LICENSE("GPL");
index 6777153f18f31c3318b94283e986b5f2866ad783..83b25580ae71413933ae20909cd1d9895e67f8e1 100644 (file)
@@ -1289,6 +1289,14 @@ config ASYNC_RAID6_TEST
 
          If unsure, say N.
 
+config TEST_MODULE
+       tristate "Test module loading with 'hello world' module"
+       depends on m
+       help
+         This builds the "test_module" module that emits "Hello, world"
+         on printk when loaded. It is designed to be used for basic
+         evaluation of the module loading subsystem.
+
 source "samples/Kconfig"
 
 source "lib/Kconfig.kgdb"