36 lines · c
1// SPDX-License-Identifier: GPL-2.0-only2/*3 * This module emits "Hello, world" on printk when loaded.4 *5 * It is designed to be used for basic evaluation of the module loading6 * subsystem (for example when validating module signing/verification). It7 * lacks any extra dependencies, and will not normally be loaded by the8 * system unless explicitly requested by name.9 */10 11#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt12 13#include <linux/init.h>14#include <linux/module.h>15#include <linux/printk.h>16 17static int __init test_module_init(void)18{19 pr_warn("Hello, world\n");20 21 return 0;22}23 24module_init(test_module_init);25 26static void __exit test_module_exit(void)27{28 pr_warn("Goodbye\n");29}30 31module_exit(test_module_exit);32 33MODULE_AUTHOR("Kees Cook <keescook@chromium.org>");34MODULE_DESCRIPTION("module loading subsystem test module");35MODULE_LICENSE("GPL");36