aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-08-20 19:10:47 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-08-20 19:10:47 -0400
commit3933ec73cd9bbff4a98259d0eae606af4e2850a2 (patch)
tree9c4f78d961c2fdaa9924666ee7e9f67ebfb04850
parent7a324b3f0535ceb0f6676fa20ca2a7b6213008cb (diff)
parentbadf58a272132c7bb953666b65ef816c1ef9efff (diff)
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()
-rw-r--r--kernel/livepatch/core.c6
-rw-r--r--kernel/livepatch/transition.c7
2 files changed, 6 insertions, 7 deletions
diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
index 3a4656fb7047..5b77a7314e01 100644
--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -678,6 +678,9 @@ static int klp_init_func(struct klp_object *obj, struct klp_func *func)
678 if (!func->old_name || !func->new_func) 678 if (!func->old_name || !func->new_func)
679 return -EINVAL; 679 return -EINVAL;
680 680
681 if (strlen(func->old_name) >= KSYM_NAME_LEN)
682 return -EINVAL;
683
681 INIT_LIST_HEAD(&func->stack_node); 684 INIT_LIST_HEAD(&func->stack_node);
682 func->patched = false; 685 func->patched = false;
683 func->transition = false; 686 func->transition = false;
@@ -751,6 +754,9 @@ static int klp_init_object(struct klp_patch *patch, struct klp_object *obj)
751 if (!obj->funcs) 754 if (!obj->funcs)
752 return -EINVAL; 755 return -EINVAL;
753 756
757 if (klp_is_module(obj) && strlen(obj->name) >= MODULE_NAME_LEN)
758 return -EINVAL;
759
754 obj->patched = false; 760 obj->patched = false;
755 obj->mod = NULL; 761 obj->mod = NULL;
756 762
diff --git a/kernel/livepatch/transition.c b/kernel/livepatch/transition.c
index 7c6631e693bc..5bc349805e03 100644
--- a/kernel/livepatch/transition.c
+++ b/kernel/livepatch/transition.c
@@ -310,13 +310,6 @@ static bool klp_try_switch_task(struct task_struct *task)
310 return true; 310 return true;
311 311
312 /* 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
319 /*
320 * Now try to check the stack for any to-be-patched or to-be-unpatched 313 * Now try to check the stack for any to-be-patched or to-be-unpatched
321 * functions. If all goes well, switch the task to the target patch 314 * functions. If all goes well, switch the task to the target patch
322 * state. 315 * state.