[CRIU] [PATCH 01/15] restore: Bootstrap len is always page-size aligned

Pavel Emelyanov xemul at virtuozzo.com
Tue May 24 04:33:36 PDT 2016


The restore_bootstrap_len is restorer, args and rst-mem lenghts.

Restorer is pie_size() from restorer, which is page-size aligned.
Args len is aligned to page-size few lines above.
The remapable rst-mem grows page by page and is aligned too.

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 criu/cr-restore.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 8e7f18e..6bc339b 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -2693,7 +2693,6 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
 
 #ifdef CONFIG_VDSO
 	unsigned long vdso_rt_size = 0;
-	unsigned long vdso_rt_delta = 0;
 #endif
 
 	unsigned long aio_rings;
@@ -2792,19 +2791,15 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
 
 	rst_mem_size = rst_mem_lock();
 	restore_bootstrap_len = restorer_len + args_len + rst_mem_size;
+	BUG_ON(restore_bootstrap_len & (PAGE_SIZE - 1));
 
 #ifdef CONFIG_VDSO
 	/*
 	 * Figure out how much memory runtime vdso and vvar will need.
 	 */
 	vdso_rt_size = vdso_vma_size(&vdso_sym_rt);
-	if (vdso_rt_size) {
-		vdso_rt_delta = ALIGN(restore_bootstrap_len, PAGE_SIZE) - restore_bootstrap_len;
-		vdso_rt_size += vdso_rt_delta;
-		if (vvar_vma_size(&vdso_sym_rt))
-			vdso_rt_size += ALIGN(vvar_vma_size(&vdso_sym_rt), PAGE_SIZE);
-	}
-
+	if (vdso_rt_size && vvar_vma_size(&vdso_sym_rt))
+		vdso_rt_size += ALIGN(vvar_vma_size(&vdso_sym_rt), PAGE_SIZE);
 	restore_bootstrap_len += vdso_rt_size;
 #endif
 
@@ -3010,7 +3005,7 @@ static int sigreturn_restore(pid_t pid, CoreEntry *core)
 	 * self-vmas are unmaped.
 	 */
 	mem += rst_mem_size;
-	task_args->vdso_rt_parked_at = (unsigned long)mem + vdso_rt_delta;
+	task_args->vdso_rt_parked_at = (unsigned long)mem;
 	task_args->vdso_sym_rt = vdso_sym_rt;
 	task_args->vdso_rt_size = vdso_rt_size;
 #endif
-- 
2.5.0



More information about the CRIU mailing list