[CRIU] [PATCH 09/11] vdso: Move parsing of self/maps outside vdso_fill_self_symtable()

Dmitry Safonov dsafonov at virtuozzo.com
Thu Jun 15 19:36:13 MSK 2017


As ASLR randomizes {vdso,vvar}_start between criu launches,
vdso_parse_maps() should be called each launch:
- on restore to know {vdso,vvar}_start position for later parking
  in restorer's save zone
- on checkpointing to get vdso's pfn for pre-v3.16 kernels
  which lose "[vdso]" hint in maps file.

But vdso_fill_symtable() call may be omitted if symtable is
inside kdat file.

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

diff --git a/criu/vdso.c b/criu/vdso.c
index b9de571abe24..f20703b1f00b 100644
--- a/criu/vdso.c
+++ b/criu/vdso.c
@@ -327,8 +327,7 @@ static int validate_vdso_addr(struct vdso_maps *s)
 
 static int vdso_fill_self_symtable(struct vdso_maps *s)
 {
-
-	if (vdso_parse_maps(PROC_SELF, s))
+	if (s->vdso_start == VDSO_BAD_ADDR || s->sym.vdso_size == VDSO_BAD_SIZE)
 		return -1;
 
 	if (vdso_fill_symtable(s->vdso_start, s->sym.vdso_size, &s->sym))
@@ -469,6 +468,11 @@ static int vdso_fill_compat_symtable(struct vdso_maps *native,
 
 int vdso_init(void)
 {
+	if (vdso_parse_maps(PROC_SELF, &vdso_maps)) {
+		pr_err("Failed reading self/maps for filling vdso/vvar bounds\n");
+		return -1;
+	}
+
 	if (vdso_fill_self_symtable(&vdso_maps)) {
 		pr_err("Failed to fill self vdso symtable\n");
 		return -1;
-- 
2.12.2



More information about the CRIU mailing list