[CRIU] [PATCH] util-vdso: correct vdso symbol's length

Dmitry Safonov dsafonov at virtuozzo.com
Fri Jul 22 08:50:12 PDT 2016


VDSO_SYMBOL_MAX is max number of symbols, not their max length.
Fixes my buggy commit: 4c69339cd2b7 ("string.h/pie: use builtin strncmp
instead of strcmp"). Sorry for that bogus misprinting.

Cc: Cyrill Gorcunov <gorcunov at openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 criu/pie/util-vdso.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/criu/pie/util-vdso.c b/criu/pie/util-vdso.c
index cd605a124d5f..2e47819f98b9 100644
--- a/criu/pie/util-vdso.c
+++ b/criu/pie/util-vdso.c
@@ -202,6 +202,7 @@ static void parse_elf_symbols(uintptr_t mem, size_t size, Phdr_t *load,
 	const char *vdso_symbols[VDSO_SYMBOL_MAX] = {
 		ARCH_VDSO_SYMBOLS
 	};
+	const size_t vdso_symbol_length = sizeof(t->symbols[0].name);
 
 	Word_t nbucket, nchain;
 	Word_t *bucket, *chain;
@@ -236,14 +237,14 @@ static void parse_elf_symbols(uintptr_t mem, size_t size, Phdr_t *load,
 				continue;
 
 			addr = dynsymbol_names + sym->st_name;
-			if (__ptr_struct_oob(addr, VDSO_SYMBOL_MAX, mem, size))
+			if (__ptr_struct_oob(addr, vdso_symbol_length, mem, size))
 				continue;
 			name = (void *)addr;
 
-			if (builtin_strncmp(name, symbol, VDSO_SYMBOL_MAX))
+			if (builtin_strncmp(name, symbol, vdso_symbol_length))
 				continue;
 
-			builtin_memcpy(t->symbols[i].name, name, VDSO_SYMBOL_MAX);
+			builtin_memcpy(t->symbols[i].name, name, vdso_symbol_length);
 			t->symbols[i].offset = (unsigned long)sym->st_value - load->p_vaddr;
 			break;
 		}
-- 
2.9.0



More information about the CRIU mailing list