0001
0002
0003
0004 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
0005
0006 #include <linux/module.h>
0007 #include <linux/kernel.h>
0008 #include <linux/livepatch.h>
0009
0010 #include <linux/seq_file.h>
0011 static int livepatch_cmdline_proc_show(struct seq_file *m, void *v)
0012 {
0013 seq_printf(m, "%s: %s\n", THIS_MODULE->name,
0014 "this has been live patched");
0015 return 0;
0016 }
0017
0018 static struct klp_func funcs[] = {
0019 {
0020 .old_name = "cmdline_proc_show",
0021 .new_func = livepatch_cmdline_proc_show,
0022 }, { }
0023 };
0024
0025 static struct klp_object objs[] = {
0026 {
0027
0028 .funcs = funcs,
0029 }, { }
0030 };
0031
0032 static struct klp_patch patch = {
0033 .mod = THIS_MODULE,
0034 .objs = objs,
0035 };
0036
0037 static int test_klp_livepatch_init(void)
0038 {
0039 return klp_enable_patch(&patch);
0040 }
0041
0042 static void test_klp_livepatch_exit(void)
0043 {
0044 }
0045
0046 module_init(test_klp_livepatch_init);
0047 module_exit(test_klp_livepatch_exit);
0048 MODULE_LICENSE("GPL");
0049 MODULE_INFO(livepatch, "Y");
0050 MODULE_AUTHOR("Seth Jennings <sjenning@redhat.com>");
0051 MODULE_DESCRIPTION("Livepatch test: livepatch module");