summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/livepatch/livepatch.txt24
-rw-r--r--kernel/livepatch/core.c6
2 files changed, 6 insertions, 24 deletions
diff --git a/Documentation/livepatch/livepatch.txt b/Documentation/livepatch/livepatch.txt
index 1ae2de758c08..2d7ed09dbd59 100644
--- a/Documentation/livepatch/livepatch.txt
+++ b/Documentation/livepatch/livepatch.txt
@@ -429,30 +429,6 @@ See Documentation/ABI/testing/sysfs-kernel-livepatch for more details.
The current Livepatch implementation has several limitations:
-
- + The patch must not change the semantic of the patched functions.
-
- The current implementation guarantees only that either the old
- or the new function is called. The functions are patched one
- by one. It means that the patch must _not_ change the semantic
- of the function.
-
-
- + Data structures can not be patched.
-
- There is no support to version data structures or anyhow migrate
- one structure into another. Also the simple consistency model does
- not allow to switch more functions atomically.
-
- Once there is more complex consistency mode, it will be possible to
- use some workarounds. For example, it will be possible to use a hole
- for a new member because the data structure is aligned. Or it will
- be possible to use an existing member for something else.
-
- There are no plans to add more generic support for modified structures
- at the moment.
-
-
+ Only functions that can be traced could be patched.
Livepatch is based on the dynamic ftrace. In particular, functions
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)
if (!func->old_name || !func->new_func)
return -EINVAL;
+ if (strlen(func->old_name) >= KSYM_NAME_LEN)
+ return -EINVAL;
+
INIT_LIST_HEAD(&func->stack_node);
func->patched = false;
func->transition = false;
@@ -751,6 +754,9 @@ static int klp_init_object(struct klp_patch *patch, struct klp_object *obj)
if (!obj->funcs)
return -EINVAL;
+ if (klp_is_module(obj) && strlen(obj->name) >= MODULE_NAME_LEN)
+ return -EINVAL;
+
obj->patched = false;
obj->mod = NULL;