[CRIU] [PATCH 12/20] vdso: separate validation from vdso_fill_self_symtable()

Dmitry Safonov dsafonov at virtuozzo.com
Fri Dec 2 11:53:36 PST 2016


I'll need to validate compat vdso/vvar positioning in the same way.

Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
 criu/vdso.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/criu/vdso.c b/criu/vdso.c
index 47f0ff498adc..232c2045e8bf 100644
--- a/criu/vdso.c
+++ b/criu/vdso.c
@@ -275,15 +275,8 @@ err:
 	return exit_code;
 }
 
-static int vdso_fill_self_symtable(struct vdso_symtable *s)
+static int validate_vdso_addr(struct vdso_symtable *s)
 {
-
-	if (vdso_parse_maps(PROC_SELF, s))
-		return -1;
-
-	if (vdso_fill_symtable(s->vma_start, s->vma_end - s->vma_start, s))
-		return -1;
-
 	/*
 	 * Validate its structure -- for new vDSO format the
 	 * structure must be like
@@ -310,6 +303,21 @@ static int vdso_fill_self_symtable(struct vdso_symtable *s)
 		return -1;
 	}
 
+	return 0;
+}
+
+static int vdso_fill_self_symtable(struct vdso_symtable *s)
+{
+
+	if (vdso_parse_maps(PROC_SELF, s))
+		return -1;
+
+	if (vdso_fill_symtable(s->vma_start, s->vma_end - s->vma_start, s))
+		return -1;
+
+	if (validate_vdso_addr(s))
+		return -1;
+
 	pr_debug("rt [vdso] %lx-%lx [vvar] %lx-%lx\n",
 		 s->vma_start, s->vma_end,
 		 s->vvar_start, s->vvar_end);
-- 
2.10.2



More information about the CRIU mailing list