Skip to content

Commit db04573

Browse files
committed
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
2 parents 1f7563f + 38195dd commit db04573

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

include/linux/livepatch.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
* @stack_node: list node for klp_ops func_stack list
3636
* @old_size: size of the old function
3737
* @new_size: size of the new function
38-
* @kobj_added: @kobj has been added and needs freeing
3938
* @nop: temporary patch to use the original code again; dyn. allocated
4039
* @patched: the func has been added to the klp_ops list
4140
* @transition: the func is currently being applied or reverted
@@ -113,7 +112,6 @@ struct klp_callbacks {
113112
* @node: list node for klp_patch obj_list
114113
* @mod: kernel module associated with the patched object
115114
* (NULL for vmlinux)
116-
* @kobj_added: @kobj has been added and needs freeing
117115
* @dynamic: temporary object for nop functions; dynamically allocated
118116
* @patched: the object's funcs have been added to the klp_ops list
119117
*/
@@ -140,7 +138,6 @@ struct klp_object {
140138
* @list: list node for global list of actively used patches
141139
* @kobj: kobject for sysfs resources
142140
* @obj_list: dynamic list of the object entries
143-
* @kobj_added: @kobj has been added and needs freeing
144141
* @enabled: the patch is enabled (but operation may be incomplete)
145142
* @forced: was involved in a forced transition
146143
* @free_work: patch cleanup from workqueue-context

kernel/livepatch/transition.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ static int klp_check_stack(struct task_struct *task, char *err_buf)
247247
int ret, nr_entries;
248248

249249
ret = stack_trace_save_tsk_reliable(task, entries, ARRAY_SIZE(entries));
250-
WARN_ON_ONCE(ret == -ENOSYS);
251250
if (ret < 0) {
252251
snprintf(err_buf, STACK_ERR_BUF_SIZE,
253252
"%s: %s:%d has an unreliable stack\n",
@@ -281,18 +280,25 @@ static int klp_check_stack(struct task_struct *task, char *err_buf)
281280
*/
282281
static bool klp_try_switch_task(struct task_struct *task)
283282
{
283+
static char err_buf[STACK_ERR_BUF_SIZE];
284284
struct rq *rq;
285285
struct rq_flags flags;
286286
int ret;
287287
bool success = false;
288-
char err_buf[STACK_ERR_BUF_SIZE];
289288

290289
err_buf[0] = '\0';
291290

292291
/* check if this task has already switched over */
293292
if (task->patch_state == klp_target_state)
294293
return true;
295294

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+
296302
/*
297303
* Now try to check the stack for any to-be-patched or to-be-unpatched
298304
* functions. If all goes well, switch the task to the target patch
@@ -328,7 +334,6 @@ static bool klp_try_switch_task(struct task_struct *task)
328334
pr_debug("%s", err_buf);
329335

330336
return success;
331-
332337
}
333338

334339
/*

kernel/stacktrace.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -255,14 +255,6 @@ save_stack_trace_regs(struct pt_regs *regs, struct stack_trace *trace)
255255
WARN_ONCE(1, KERN_INFO "save_stack_trace_regs() not implemented yet.\n");
256256
}
257257

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-
266258
/**
267259
* stack_trace_save - Save a stack trace into a storage array
268260
* @store: Pointer to storage array

0 commit comments

Comments
 (0)