diff options
Diffstat (limited to 'lib/test_module.c')
| -rw-r--r-- | lib/test_module.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/test_module.c b/lib/test_module.c new file mode 100644 index 000000000000..3d1b29b74807 --- /dev/null +++ b/lib/test_module.c @@ -0,0 +1,35 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * This module emits "Hello, world" on printk when loaded. + * + * It is designed to be used for basic evaluation of the module loading + * subsystem (for example when validating module signing/verification). It + * lacks any extra dependencies, and will not normally be loaded by the + * system unless explicitly requested by name. + */ + +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt + +#include <linux/init.h> +#include <linux/module.h> +#include <linux/printk.h> + +static int __init test_module_init(void) +{ + pr_warn("Hello, world\n"); + + return 0; +} + +module_init(test_module_init); + +static void __exit test_module_exit(void) +{ + pr_warn("Goodbye\n"); +} + +module_exit(test_module_exit); + +MODULE_AUTHOR("Kees Cook <keescook@chromium.org>"); +MODULE_DESCRIPTION("module loading subsystem test module"); +MODULE_LICENSE("GPL"); |
