Skip to content

Commit 3933ec7

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching
Pull livepatching updates from Jiri Kosina: "Code cleanups from Kamalesh Babulal" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/livepatching: livepatch: Validate module/old func name length livepatch: Remove reliable stacktrace check in klp_try_switch_task()
2 parents 7a324b3 + badf58a commit 3933ec7

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

kernel/livepatch/core.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,9 @@ static int klp_init_func(struct klp_object *obj, struct klp_func *func)
678678
if (!func->old_name || !func->new_func)
679679
return -EINVAL;
680680

681+
if (strlen(func->old_name) >= KSYM_NAME_LEN)
682+
return -EINVAL;
683+
681684
INIT_LIST_HEAD(&func->stack_node);
682685
func->patched = false;
683686
func->transition = false;
@@ -751,6 +754,9 @@ static int klp_init_object(struct klp_patch *patch, struct klp_object *obj)
751754
if (!obj->funcs)
752755
return -EINVAL;
753756

757+
if (klp_is_module(obj) && strlen(obj->name) >= MODULE_NAME_LEN)
758+
return -EINVAL;
759+
754760
obj->patched = false;
755761
obj->mod = NULL;
756762

kernel/livepatch/transition.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -309,13 +309,6 @@ static bool klp_try_switch_task(struct task_struct *task)
309309
if (task->patch_state == klp_target_state)
310310
return true;
311311

312-
/*
313-
* For arches which don't have reliable stack traces, we have to rely
314-
* on other methods (e.g., switching tasks at kernel exit).
315-
*/
316-
if (!klp_have_reliable_stack())
317-
return false;
318-
319312
/*
320313
* Now try to check the stack for any to-be-patched or to-be-unpatched
321314
* functions. If all goes well, switch the task to the target patch

0 commit comments

Comments
 (0)