This source file includes following definitions.
- livepatch_cmdline_proc_show
- livepatch_init
- livepatch_exit
1
2
3
4
5
6
7
8 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
9
10 #include <linux/module.h>
11 #include <linux/kernel.h>
12 #include <linux/livepatch.h>
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 #include <linux/seq_file.h>
33 static int livepatch_cmdline_proc_show(struct seq_file *m, void *v)
34 {
35 seq_printf(m, "%s\n", "this has been live patched");
36 return 0;
37 }
38
39 static struct klp_func funcs[] = {
40 {
41 .old_name = "cmdline_proc_show",
42 .new_func = livepatch_cmdline_proc_show,
43 }, { }
44 };
45
46 static struct klp_object objs[] = {
47 {
48
49 .funcs = funcs,
50 }, { }
51 };
52
53 static struct klp_patch patch = {
54 .mod = THIS_MODULE,
55 .objs = objs,
56 };
57
58 static int livepatch_init(void)
59 {
60 return klp_enable_patch(&patch);
61 }
62
63 static void livepatch_exit(void)
64 {
65 }
66
67 module_init(livepatch_init);
68 module_exit(livepatch_exit);
69 MODULE_LICENSE("GPL");
70 MODULE_INFO(livepatch, "Y");