[PATCH 2/2] livepatch: Fix the bug if the function name is larger than KSYM_NAME_LEN-1

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For now, the kallsyms will only store the first (KSYM_NAME_LEN-1). The
kallsyms name is same for the function which first (KSYM_NAME_LEN-1) is
same, but the rest is not.

Then function will never be patched, although function name and address
are provided both. The reason caused this bug is livepatch cannt
recognize the function name.

Now, livepatch will verify the function name with first (KSYM_NAME_LEN-1)
and address, if provided. Once they are matched, we can confirm that the
patched function is found.

Signed-off-by: Minfei Huang <minfei.huang@xxxxxxxxxxx>
---
 kernel/livepatch/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
index ff42c29..eed719d 100644
--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -210,7 +210,7 @@ static int klp_verify_vmlinux_callback(void *data, const char *name,
 	struct klp_verify_args *args = data;
 
 	if (!mod &&
-	    !strcmp(args->name, name) &&
+	    !strncmp(args->name, name, KSYM_NAME_LEN-1) &&
 	    args->addr == addr)
 		return 1;
 
@@ -226,7 +226,7 @@ static int klp_verify_module_callback(void *data, const char *name,
 		return 0;
 
 	if (!strcmp(args->objname, mod->name) &&
-	    !strcmp(args->name, name) &&
+	    !strncmp(args->name, name, KSYM_NAME_LEN-1) &&
 	    args->addr == addr)
 		return 1;
 
-- 
2.2.2

--
To unsubscribe from this list: send the line "unsubscribe live-patching" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux Kernel]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux