diff options
Diffstat (limited to 'include/linux/livepatch.h')
-rw-r--r-- | include/linux/livepatch.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h index d08eddc00497..fc5c1be3f6f4 100644 --- a/include/linux/livepatch.h +++ b/include/linux/livepatch.h | |||
@@ -87,10 +87,35 @@ struct klp_func { | |||
87 | bool transition; | 87 | bool transition; |
88 | }; | 88 | }; |
89 | 89 | ||
90 | struct klp_object; | ||
91 | |||
92 | /** | ||
93 | * struct klp_callbacks - pre/post live-(un)patch callback structure | ||
94 | * @pre_patch: executed before code patching | ||
95 | * @post_patch: executed after code patching | ||
96 | * @pre_unpatch: executed before code unpatching | ||
97 | * @post_unpatch: executed after code unpatching | ||
98 | * @post_unpatch_enabled: flag indicating if post-unpatch callback | ||
99 | * should run | ||
100 | * | ||
101 | * All callbacks are optional. Only the pre-patch callback, if provided, | ||
102 | * will be unconditionally executed. If the parent klp_object fails to | ||
103 | * patch for any reason, including a non-zero error status returned from | ||
104 | * the pre-patch callback, no further callbacks will be executed. | ||
105 | */ | ||
106 | struct klp_callbacks { | ||
107 | int (*pre_patch)(struct klp_object *obj); | ||
108 | void (*post_patch)(struct klp_object *obj); | ||
109 | void (*pre_unpatch)(struct klp_object *obj); | ||
110 | void (*post_unpatch)(struct klp_object *obj); | ||
111 | bool post_unpatch_enabled; | ||
112 | }; | ||
113 | |||
90 | /** | 114 | /** |
91 | * struct klp_object - kernel object structure for live patching | 115 | * struct klp_object - kernel object structure for live patching |
92 | * @name: module name (or NULL for vmlinux) | 116 | * @name: module name (or NULL for vmlinux) |
93 | * @funcs: function entries for functions to be patched in the object | 117 | * @funcs: function entries for functions to be patched in the object |
118 | * @callbacks: functions to be executed pre/post (un)patching | ||
94 | * @kobj: kobject for sysfs resources | 119 | * @kobj: kobject for sysfs resources |
95 | * @mod: kernel module associated with the patched object | 120 | * @mod: kernel module associated with the patched object |
96 | * (NULL for vmlinux) | 121 | * (NULL for vmlinux) |
@@ -100,6 +125,7 @@ struct klp_object { | |||
100 | /* external */ | 125 | /* external */ |
101 | const char *name; | 126 | const char *name; |
102 | struct klp_func *funcs; | 127 | struct klp_func *funcs; |
128 | struct klp_callbacks callbacks; | ||
103 | 129 | ||
104 | /* internal */ | 130 | /* internal */ |
105 | struct kobject kobj; | 131 | struct kobject kobj; |