mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-28 21:07:43 +00:00
restore: Increase the stack size for cloned processes
Wasted a couple of hours trying to resolve this non-obvious issue. It's because bootstrapping the restorer code might requre more memory than 16K on stack. Strictly speaking we need a compile time constant here and BUG_ON. Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
parent
b78c664bca
commit
275e97c77d
@ -1097,17 +1097,18 @@ static int do_child(void *arg)
|
|||||||
|
|
||||||
static inline int fork_with_pid(int pid, char *pstree_path)
|
static inline int fork_with_pid(int pid, char *pstree_path)
|
||||||
{
|
{
|
||||||
|
const int stack_size = 128 << 10;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
void *stack;
|
void *stack;
|
||||||
|
|
||||||
stack = mmap(0, 4 * 4096, PROT_READ | PROT_WRITE,
|
stack = mmap(0, stack_size, PROT_READ | PROT_WRITE,
|
||||||
MAP_PRIVATE | MAP_ANON | MAP_GROWSDOWN, 0, 0);
|
MAP_PRIVATE | MAP_ANON | MAP_GROWSDOWN, 0, 0);
|
||||||
if (stack == MAP_FAILED) {
|
if (stack == MAP_FAILED) {
|
||||||
pr_perror("mmap failed");
|
pr_perror("mmap failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
stack += 4 * 4096;
|
stack += stack_size;
|
||||||
ret = clone(do_child, stack, SIGCHLD | CLONE_CHILD_USEPID, pstree_path, NULL, NULL, &pid);
|
ret = clone(do_child, stack, SIGCHLD | CLONE_CHILD_USEPID, pstree_path, NULL, NULL, &pid);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
pr_perror("clone failed\n");
|
pr_perror("clone failed\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user