Skip to content

Commit 38195dd

Browse files
author
Jiri Kosina
committed
Merge branch 'for-5.3/core' into for-linus
2 parents aec71d7 + ac59a47 commit 38195dd

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

kernel/livepatch/transition.c

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

261261
ret = stack_trace_save_tsk_reliable(task, entries, ARRAY_SIZE(entries));
262-
WARN_ON_ONCE(ret == -ENOSYS);
263262
if (ret < 0) {
264263
snprintf(err_buf, STACK_ERR_BUF_SIZE,
265264
"%s: %s:%d has an unreliable stack\n",
@@ -293,18 +292,25 @@ static int klp_check_stack(struct task_struct *task, char *err_buf)
293292
*/
294293
static bool klp_try_switch_task(struct task_struct *task)
295294
{
295+
static char err_buf[STACK_ERR_BUF_SIZE];
296296
struct rq *rq;
297297
struct rq_flags flags;
298298
int ret;
299299
bool success = false;
300-
char err_buf[STACK_ERR_BUF_SIZE];
301300

302301
err_buf[0] = '\0';
303302

304303
/* check if this task has already switched over */
305304
if (task->patch_state == klp_target_state)
306305
return true;
307306

307+
/*
308+
* For arches which don't have reliable stack traces, we have to rely
309+
* on other methods (e.g., switching tasks at kernel exit).
310+
*/
311+
if (!klp_have_reliable_stack())
312+
return false;
313+
308314
/*
309315
* Now try to check the stack for any to-be-patched or to-be-unpatched
310316
* functions. If all goes well, switch the task to the target patch
@@ -340,7 +346,6 @@ static bool klp_try_switch_task(struct task_struct *task)
340346
pr_debug("%s", err_buf);
341347

342348
return success;
343-
344349
}
345350

346351
/*

kernel/stacktrace.c

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

257-
__weak int
258-
save_stack_trace_tsk_reliable(struct task_struct *tsk,
259-
struct stack_trace *trace)
260-
{
261-
WARN_ONCE(1, KERN_INFO "save_stack_tsk_reliable() not implemented yet.\n");
262-
return -ENOSYS;
263-
}
264-
265257
/**
266258
* stack_trace_save - Save a stack trace into a storage array
267259
* @store: Pointer to storage array

0 commit comments

Comments
 (0)