parasite: Relax size checking for get_exec_start()

Submitted by Pavel Emelianov on Oct. 17, 2016, 12:04 p.m.

Details

Message ID 5804BE62.30109@virtuozzo.com
State Accepted
Series "parasite: Relax size checking for get_exec_start()"
Commit 6535e16a4d62c69df7b6715d9ac5fccda44df126
Headers show

Commit Message

Pavel Emelianov Oct. 17, 2016, 12:04 p.m.
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@virtuozzo.com>

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

Patch hide | download patch | download mbox

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);