[CRIU] [PATCH] parasite: Relax size checking for get_exec_start()

Pavel Emelyanov xemul at virtuozzo.com
Mon Oct 17 05:04:50 PDT 2016


For compel-ization it's MUCH easier to introduce single 
constant, all the more so no VMAs can be shorter than
one page :)

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>

---
 criu/include/parasite.h | 1 +
 criu/parasite-syscall.c | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/criu/include/parasite.h b/criu/include/parasite.h
index 7211477..d248bbc 100644
--- a/criu/include/parasite.h
+++ b/criu/include/parasite.h
@@ -3,6 +3,7 @@
 
 #define PARASITE_STACK_SIZE	(16 << 10)
 #define PARASITE_ARG_SIZE_MIN	( 1 << 12)
+#define PARASITE_START_AREA_MIN	(4096)
 
 #define PARASITE_MAX_SIZE	(64 << 10)
 
diff --git a/criu/parasite-syscall.c b/criu/parasite-syscall.c
index 476bae8..cf7c5bc 100644
--- a/criu/parasite-syscall.c
+++ b/criu/parasite-syscall.c
@@ -57,7 +57,7 @@ unsigned long get_exec_start(struct vm_area_list *vmas)
 			continue;
 
 		len = vma_area_len(vma_area);
-		if (len < BUILTIN_SYSCALL_SIZE + MEMFD_FNAME_SZ) {
+		if (len < PARASITE_START_AREA_MIN) {
 			pr_warn("Suspiciously short VMA @%#lx\n", (unsigned long)vma_area->e->start);
 			continue;
 		}
@@ -1262,6 +1262,8 @@ struct parasite_ctl *parasite_prep_ctl(pid_t pid, unsigned long exec_start)
 
 	ctl->rpid = pid;
 
+	BUILD_BUG_ON(PARASITE_START_AREA_MIN < BUILTIN_SYSCALL_SIZE + MEMFD_FNAME_SZ);
+
 	ctl->syscall_ip = exec_start;
 	pr_debug("Parasite syscall_ip at %p\n", (void *)ctl->syscall_ip);
 
-- 
2.5.0


More information about the CRIU mailing list