diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-11 18:30:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-11 18:30:05 -0400 |
commit | db0457338ece7482378d88e50ad298191c3e6947 (patch) | |
tree | 459378b5005622cdf9b3bccfb798229c20aa41a2 | |
parent | 1f7563f743d7081710a9d186a8b203997d09f383 (diff) | |
parent | 38195dd5e916f3e55aec585703f2432562c2db02 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/livepatching/livepatching
Pull livepatching updates from Jiri Kosina:
- stacktrace handling improvements from Miroslav benes
- debug output improvements from Petr Mladek
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/livepatching/livepatching:
livepatch: Remove duplicate warning about missing reliable stacktrace support
Revert "livepatch: Remove reliable stacktrace check in klp_try_switch_task()"
stacktrace: Remove weak version of save_stack_trace_tsk_reliable()
livepatch: Use static buffer for debugging messages under rq lock
livepatch: Remove stale kobj_added entries from kernel-doc descriptions
-rw-r--r-- | include/linux/livepatch.h | 3 | ||||
-rw-r--r-- | kernel/livepatch/transition.c | 11 | ||||
-rw-r--r-- | kernel/stacktrace.c | 8 |
3 files changed, 8 insertions, 14 deletions
diff --git a/include/linux/livepatch.h b/include/linux/livepatch.h index eeba421cc671..273400814020 100644 --- a/include/linux/livepatch.h +++ b/include/linux/livepatch.h | |||
@@ -35,7 +35,6 @@ | |||
35 | * @stack_node: list node for klp_ops func_stack list | 35 | * @stack_node: list node for klp_ops func_stack list |
36 | * @old_size: size of the old function | 36 | * @old_size: size of the old function |
37 | * @new_size: size of the new function | 37 | * @new_size: size of the new function |
38 | * @kobj_added: @kobj has been added and needs freeing | ||
39 | * @nop: temporary patch to use the original code again; dyn. allocated | 38 | * @nop: temporary patch to use the original code again; dyn. allocated |
40 | * @patched: the func has been added to the klp_ops list | 39 | * @patched: the func has been added to the klp_ops list |
41 | * @transition: the func is currently being applied or reverted | 40 | * @transition: the func is currently being applied or reverted |
@@ -113,7 +112,6 @@ struct klp_callbacks { | |||
113 | * @node: list node for klp_patch obj_list | 112 | * @node: list node for klp_patch obj_list |
114 | * @mod: kernel module associated with the patched object | 113 | * @mod: kernel module associated with the patched object |
115 | * (NULL for vmlinux) | 114 | * (NULL for vmlinux) |
116 | * @kobj_added: @kobj has been added and needs freeing | ||
117 | * @dynamic: temporary object for nop functions; dynamically allocated | 115 | * @dynamic: temporary object for nop functions; dynamically allocated |
118 | * @patched: the object's funcs have been added to the klp_ops list | 116 | * @patched: the object's funcs have been added to the klp_ops list |
119 | */ | 117 | */ |
@@ -140,7 +138,6 @@ struct klp_object { | |||
140 | * @list: list node for global list of actively used patches | 138 | * @list: list node for global list of actively used patches |
141 | * @kobj: kobject for sysfs resources | 139 | * @kobj: kobject for sysfs resources |
142 | * @obj_list: dynamic list of the object entries | 140 | * @obj_list: dynamic list of the object entries |
143 | * @kobj_added: @kobj has been added and needs freeing | ||
144 | * @enabled: the patch is enabled (but operation may be incomplete) | 141 | * @enabled: the patch is enabled (but operation may be incomplete) |
145 | * @forced: was involved in a forced transition | 142 | * @forced: was involved in a forced transition |
146 | * @free_work: patch cleanup from workqueue-context | 143 | * @free_work: patch cleanup from workqueue-context |
diff --git a/kernel/livepatch/transition.c b/kernel/livepatch/transition.c index abb2a4a2cbb2..cdf318d86dd6 100644 --- a/kernel/livepatch/transition.c +++ b/kernel/livepatch/transition.c | |||
@@ -247,7 +247,6 @@ static int klp_check_stack(struct task_struct *task, char *err_buf) | |||
247 | int ret, nr_entries; | 247 | int ret, nr_entries; |
248 | 248 | ||
249 | ret = stack_trace_save_tsk_reliable(task, entries, ARRAY_SIZE(entries)); | 249 | ret = stack_trace_save_tsk_reliable(task, entries, ARRAY_SIZE(entries)); |
250 | WARN_ON_ONCE(ret == -ENOSYS); | ||
251 | if (ret < 0) { | 250 | if (ret < 0) { |
252 | snprintf(err_buf, STACK_ERR_BUF_SIZE, | 251 | snprintf(err_buf, STACK_ERR_BUF_SIZE, |
253 | "%s: %s:%d has an unreliable stack\n", | 252 | "%s: %s:%d has an unreliable stack\n", |
@@ -281,11 +280,11 @@ static int klp_check_stack(struct task_struct *task, char *err_buf) | |||
281 | */ | 280 | */ |
282 | static bool klp_try_switch_task(struct task_struct *task) | 281 | static bool klp_try_switch_task(struct task_struct *task) |
283 | { | 282 | { |
283 | static char err_buf[STACK_ERR_BUF_SIZE]; | ||
284 | struct rq *rq; | 284 | struct rq *rq; |
285 | struct rq_flags flags; | 285 | struct rq_flags flags; |
286 | int ret; | 286 | int ret; |
287 | bool success = false; | 287 | bool success = false; |
288 | char err_buf[STACK_ERR_BUF_SIZE]; | ||
289 | 288 | ||
290 | err_buf[0] = '\0'; | 289 | err_buf[0] = '\0'; |
291 | 290 | ||
@@ -294,6 +293,13 @@ static bool klp_try_switch_task(struct task_struct *task) | |||
294 | return true; | 293 | return true; |
295 | 294 | ||
296 | /* | 295 | /* |
296 | * For arches which don't have reliable stack traces, we have to rely | ||
297 | * on other methods (e.g., switching tasks at kernel exit). | ||
298 | */ | ||
299 | if (!klp_have_reliable_stack()) | ||
300 | return false; | ||
301 | |||
302 | /* | ||
297 | * Now try to check the stack for any to-be-patched or to-be-unpatched | 303 | * Now try to check the stack for any to-be-patched or to-be-unpatched |
298 | * functions. If all goes well, switch the task to the target patch | 304 | * functions. If all goes well, switch the task to the target patch |
299 | * state. | 305 | * state. |
@@ -328,7 +334,6 @@ done: | |||
328 | pr_debug("%s", err_buf); | 334 | pr_debug("%s", err_buf); |
329 | 335 | ||
330 | return success; | 336 | return success; |
331 | |||
332 | } | 337 | } |
333 | 338 | ||
334 | /* | 339 | /* |
diff --git a/kernel/stacktrace.c b/kernel/stacktrace.c index c8d0f05721a1..e6a02b274b73 100644 --- a/kernel/stacktrace.c +++ b/kernel/stacktrace.c | |||
@@ -255,14 +255,6 @@ save_stack_trace_regs(struct pt_regs *regs, struct stack_trace *trace) | |||
255 | WARN_ONCE(1, KERN_INFO "save_stack_trace_regs() not implemented yet.\n"); | 255 | WARN_ONCE(1, KERN_INFO "save_stack_trace_regs() not implemented yet.\n"); |
256 | } | 256 | } |
257 | 257 | ||
258 | __weak int | ||
259 | save_stack_trace_tsk_reliable(struct task_struct *tsk, | ||
260 | struct stack_trace *trace) | ||
261 | { | ||
262 | WARN_ONCE(1, KERN_INFO "save_stack_tsk_reliable() not implemented yet.\n"); | ||
263 | return -ENOSYS; | ||
264 | } | ||
265 | |||
266 | /** | 258 | /** |
267 | * stack_trace_save - Save a stack trace into a storage array | 259 | * stack_trace_save - Save a stack trace into a storage array |
268 | * @store: Pointer to storage array | 260 | * @store: Pointer to storage array |