1 // SPDX-License-Identifier: GPL-2.0 2 // Copyright (C) 2026 Pablo Hugen <phugen@redhat.com> 3 4 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 5 6 #include <linux/module.h> 7 #include <linux/kernel.h> 8 #include <linux/proc_fs.h> 9 #include <linux/seq_file.h> 10 11 static struct proc_dir_entry *pde; 12 13 static noinline int test_klp_mod_target_show(struct seq_file *m, void *v) 14 { 15 seq_printf(m, "%s: %s\n", THIS_MODULE->name, "original output"); 16 return 0; 17 } 18 19 static int test_klp_mod_target_init(void) 20 { 21 pr_info("%s\n", __func__); 22 pde = proc_create_single("test_klp_mod_target", 0, NULL, 23 test_klp_mod_target_show); 24 if (!pde) 25 return -ENOMEM; 26 return 0; 27 } 28 29 static void test_klp_mod_target_exit(void) 30 { 31 pr_info("%s\n", __func__); 32 proc_remove(pde); 33 } 34 35 module_init(test_klp_mod_target_init); 36 module_exit(test_klp_mod_target_exit); 37 MODULE_LICENSE("GPL"); 38 MODULE_AUTHOR("Pablo Hugen <phugen@redhat.com>"); 39 MODULE_DESCRIPTION("Livepatch test: target module with proc entry"); 40