[CRIU] [PATCH 2/2] vdso/compat: Don't unmap missing vdso/vvar vmas

Dmitry Safonov dsafonov at virtuozzo.com
Thu May 18 11:10:19 PDT 2017


I've met missing vvar on Virtuozzo 7 kernel - just skip
unmapping it.

TODO: check ia32 C/R with kernel CONFIG_VDSO=n

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

diff --git a/criu/vdso-compat.c b/criu/vdso-compat.c
index 7669eb3df5d4..757377a15a29 100644
--- a/criu/vdso-compat.c
+++ b/criu/vdso-compat.c
@@ -41,13 +41,17 @@ void compat_vdso_helper(struct vdso_symtable *native, int pipe_fd,
 	long vdso_size;
 	long ret;
 
-	vma_size = native->vma_end - native->vma_start;
-	ret = syscall(__NR_munmap, native->vma_start, vma_size);
-	exit_on(ret, err_fd, "Error: Failed to unmap native vdso\n");
+	if (native->vma_start != VDSO_BAD_ADDR) {
+		vma_size = native->vma_end - native->vma_start;
+		ret = syscall(__NR_munmap, native->vma_start, vma_size);
+		exit_on(ret, err_fd, "Error: Failed to unmap native vdso\n");
+	}
 
-	vma_size = native->vvar_end - native->vvar_start;
-	ret = syscall(__NR_munmap, native->vvar_start, vma_size);
-	exit_on(ret, err_fd, "Error: Failed to unmap native vvar\n");
+	if (native->vvar_start != VVAR_BAD_ADDR) {
+		vma_size = native->vvar_end - native->vvar_start;
+		ret = syscall(__NR_munmap, native->vvar_start, vma_size);
+		exit_on(ret, err_fd, "Error: Failed to unmap native vvar\n");
+	}
 
 	ret = syscall(__NR_arch_prctl, ARCH_MAP_VDSO_32, native->vma_start);
 	if (ret < 0)
-- 
2.12.2



More information about the CRIU mailing list