[CRIU] [PATCH 3/3] vdso: Revert "vdso: suppress not ELF vDSO error" and simplify error handling

Cyrill Gorcunov gorcunov at openvz.org
Wed Jul 6 14:15:25 PDT 2016


This reverts commit 44bdff4b1e4e16eaf0de0e9f9d7446e416d9c66e.

Actually it's pretty clean from caller debug print that
we're looking for Elf to parse. So instead of adding
more parameters into functions simply zap this header
mismatch message.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 criu/include/util-vdso.h |  3 +--
 criu/pie/parasite-vdso.c | 10 +++++-----
 criu/pie/parasite.c      |  3 +--
 criu/pie/util-vdso.c     | 14 ++++++--------
 criu/vdso.c              |  2 +-
 5 files changed, 14 insertions(+), 18 deletions(-)

diff --git a/criu/include/util-vdso.h b/criu/include/util-vdso.h
index decfedbb45b5..63bc70d79f3e 100644
--- a/criu/include/util-vdso.h
+++ b/criu/include/util-vdso.h
@@ -92,7 +92,6 @@ static inline unsigned long vvar_vma_size(struct vdso_symtable *t)
 # define vdso_fill_symtable vdso_fill_symtable_compat
 #endif
 
-extern int vdso_fill_symtable(uintptr_t mem, size_t size,
-		struct vdso_symtable *t, bool suppress_not_elf_err);
+extern int vdso_fill_symtable(uintptr_t mem, size_t size, struct vdso_symtable *t);
 
 #endif /* __CR_UTIL_VDSO_H__ */
diff --git a/criu/pie/parasite-vdso.c b/criu/pie/parasite-vdso.c
index 3966dcaf0c7d..f838f826d24c 100644
--- a/criu/pie/parasite-vdso.c
+++ b/criu/pie/parasite-vdso.c
@@ -74,7 +74,7 @@ int vdso_do_park(struct vdso_symtable *sym_rt, unsigned long park_at, unsigned l
 # define ARCH_MAP_VDSO_32	0x2002
 #endif
 extern int vdso_fill_symtable_compat(uintptr_t mem, size_t size,
-		struct vdso_symtable *t, bool suppress_not_elf_err);
+		struct vdso_symtable *t);
 
 int vdso_map_compat(unsigned long map_at, unsigned long park_size,
 		struct vdso_symtable *sym_rt)
@@ -96,7 +96,7 @@ int vdso_map_compat(unsigned long map_at, unsigned long park_size,
 			search_vdso += PAGE_SIZE)
 	{
 		ret = vdso_fill_symtable_compat(search_vdso,
-			map_at + park_size - search_vdso, sym_rt, true);
+			map_at + park_size - search_vdso, sym_rt);
 		if (!ret)
 			return 0;
 	}
@@ -108,9 +108,9 @@ int __vdso_fill_symtable(uintptr_t mem, size_t size,
 		struct vdso_symtable *t, bool compat_vdso)
 {
 	if (compat_vdso)
-		return vdso_fill_symtable_compat(mem, size, t, false);
+		return vdso_fill_symtable_compat(mem, size, t);
 	else
-		return vdso_fill_symtable(mem, size, t, false);
+		return vdso_fill_symtable(mem, size, t);
 }
 #else
 int vdso_map_compat(unsigned long __always_unused map_at,
@@ -122,7 +122,7 @@ int vdso_map_compat(unsigned long __always_unused map_at,
 int __vdso_fill_symtable(uintptr_t mem, size_t size,
 		struct vdso_symtable *t, bool __always_unused compat_vdso)
 {
-	return vdso_fill_symtable(mem, size, t, false);
+	return vdso_fill_symtable(mem, size, t);
 }
 #endif
 
diff --git a/criu/pie/parasite.c b/criu/pie/parasite.c
index 50c80b12d966..b0dbafa6cfd5 100644
--- a/criu/pie/parasite.c
+++ b/criu/pie/parasite.c
@@ -509,8 +509,7 @@ static int parasite_check_vdso_mark(struct parasite_vdso_vma_entry *args)
 		if (args->try_fill_symtable) {
 			struct vdso_symtable t;
 
-			if (vdso_fill_symtable(args->start,
-						args->len, &t, false))
+			if (vdso_fill_symtable(args->start, args->len, &t))
 				args->is_vdso = false;
 			else
 				args->is_vdso = true;
diff --git a/criu/pie/util-vdso.c b/criu/pie/util-vdso.c
index 7d50a530c402..13b2e5316db7 100644
--- a/criu/pie/util-vdso.c
+++ b/criu/pie/util-vdso.c
@@ -64,7 +64,7 @@ static unsigned long elf_hash(const unsigned char *name)
 	return h;
 }
 
-static int has_elf_identity(Ehdr_t *ehdr, bool suppress_not_elf_err)
+static int has_elf_identity(Ehdr_t *ehdr)
 {
 	/*
 	 * See Elf specification for this magic values.
@@ -84,8 +84,7 @@ static int has_elf_identity(Ehdr_t *ehdr, bool suppress_not_elf_err)
 	BUILD_BUG_ON(sizeof(elf_ident) != sizeof(ehdr->e_ident));
 
 	if (builtin_memcmp(ehdr->e_ident, elf_ident, sizeof(elf_ident))) {
-		if (!suppress_not_elf_err)
-			pr_err("Elf header magic mismatch\n");
+		pr_err("Elf header magic mismatch\n");
 		return false;
 	}
 
@@ -93,7 +92,7 @@ static int has_elf_identity(Ehdr_t *ehdr, bool suppress_not_elf_err)
 }
 
 static int parse_elf_phdr(uintptr_t mem, size_t size,
-		Phdr_t **dynamic, Phdr_t **load, bool suppress_not_elf_err)
+		Phdr_t **dynamic, Phdr_t **load)
 {
 	Ehdr_t *ehdr = (void *)mem;
 	uintptr_t addr;
@@ -105,7 +104,7 @@ static int parse_elf_phdr(uintptr_t mem, size_t size,
 	/*
 	 * Make sure it's a file we support.
 	 */
-	if (!has_elf_identity(ehdr, suppress_not_elf_err))
+	if (!has_elf_identity(ehdr))
 		return -EINVAL;
 
 	addr = mem + ehdr->e_phoff;
@@ -254,8 +253,7 @@ static void parse_elf_symbols(uintptr_t mem, size_t size, Phdr_t *load,
 	}
 }
 
-int vdso_fill_symtable(uintptr_t mem, size_t size,
-		struct vdso_symtable *t, bool suppress_not_elf_err)
+int vdso_fill_symtable(uintptr_t mem, size_t size, struct vdso_symtable *t)
 {
 	Phdr_t *dynamic = NULL, *load = NULL;
 	Dyn_t *dyn_strtab = NULL;
@@ -272,7 +270,7 @@ int vdso_fill_symtable(uintptr_t mem, size_t size,
 	/*
 	 * We need PT_LOAD and PT_DYNAMIC here. Each once.
 	 */
-	ret = parse_elf_phdr(mem, size, &dynamic, &load, suppress_not_elf_err);
+	ret = parse_elf_phdr(mem, size, &dynamic, &load);
 	if (ret < 0)
 		return ret;
 	if (!load || !dynamic) {
diff --git a/criu/vdso.c b/criu/vdso.c
index f057386f04e2..057b2adb4d74 100644
--- a/criu/vdso.c
+++ b/criu/vdso.c
@@ -264,7 +264,7 @@ static int vdso_fill_self_symtable(struct vdso_symtable *s)
 			s->vma_start = start;
 			s->vma_end = end;
 
-			ret = vdso_fill_symtable(start, end - start, s, false);
+			ret = vdso_fill_symtable(start, end - start, s);
 			if (ret)
 				goto err;
 		} else {
-- 
2.7.4



More information about the CRIU mailing list