[CRIU] [PATCH] criu/clone: stack size is too small for Android

ning.a.zhang at intel.com ning.a.zhang at intel.com
Thu Apr 18 05:13:58 MSK 2019


From: Zhang Ning <ning.a.zhang at intel.com>

stack for clone is too small, child process will get
wild pointer, and segfault.

Error (criu/cr-restore.c:1418): 6082 killed by signal 11: Segmentation fault
Error (criu/cr-restore.c:2303): Restoring FAILED.

enlarge stack size to 1024, then no segfault.

Cc: Chen Hu <hu1.chen at intel.com>
Signed-off-by: Zhang Ning <ning.a.zhang at intel.com>
---
 criu/clone-noasan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/criu/clone-noasan.c b/criu/clone-noasan.c
index c44e7196..5ca280eb 100644
--- a/criu/clone-noasan.c
+++ b/criu/clone-noasan.c
@@ -21,7 +21,7 @@
  */
 int clone_noasan(int (*fn)(void *), int flags, void *arg)
 {
-	void *stack_ptr = (void *)round_down((unsigned long)&stack_ptr - 256, 16);
+	void *stack_ptr = (void *)round_down((unsigned long)&stack_ptr - 1024, 16);
 	BUG_ON((flags & CLONE_VM) && !(flags & CLONE_VFORK));
 	/*
 	 * Reserve some bytes for clone() internal needs
-- 
2.20.1



More information about the CRIU mailing list