CHROMIUM: add test_module module
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>
This commit is contained in:
@@ -44,6 +44,7 @@ obj-$(CONFIG_UID16) += uid16.o
|
||||
obj-$(CONFIG_SYSTEM_TRUSTED_KEYRING) += system_keyring.o system_certificates.o
|
||||
obj-$(CONFIG_MODULES) += module.o
|
||||
obj-$(CONFIG_MODULE_SIG) += module_signing.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
|
||||
|
||||
26
kernel/test_module.c
Normal file
26
kernel/test_module.c
Normal file
@@ -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");
|
||||
@@ -1611,6 +1611,14 @@ config TEST_USER_COPY
|
||||
|
||||
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"
|
||||
|
||||
Reference in New Issue
Block a user