mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-29 13:28:27 +00:00
mnt: Populate ROOT_FD_OFF
This patch populates and occupies ROOT_FD_OFF fd, which guarantees it won't be reused by ordinary fds. v4: New Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
This commit is contained in:
parent
99e56c7e8c
commit
a40231a0ce
@ -512,6 +512,23 @@ static int setup_child_task_namespaces(struct pstree_item *item, struct ns_id **
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* This actually populates and occupies ROOT_FD_OFF sfd */
|
||||
static int populate_root_fd_off(void)
|
||||
{
|
||||
struct ns_id *mntns = NULL;
|
||||
int ret;
|
||||
|
||||
if (root_ns_mask & CLONE_NEWNS) {
|
||||
mntns = lookup_ns_by_id(root_item->ids->mnt_ns_id, &mnt_ns_desc);
|
||||
BUG_ON(!mntns);
|
||||
}
|
||||
|
||||
ret = mntns_get_root_fd(mntns);
|
||||
if (ret < 0)
|
||||
pr_err("Can't get root fd\n");
|
||||
return ret >= 0 ? 0 : -1;
|
||||
}
|
||||
|
||||
static rt_sigaction_t sigchld_act;
|
||||
/*
|
||||
* If parent's sigaction has blocked SIGKILL (which is non-sence),
|
||||
@ -1863,6 +1880,9 @@ static int restore_task_with_children(void *_arg)
|
||||
|
||||
if (root_prepare_shared())
|
||||
goto err;
|
||||
|
||||
if (populate_root_fd_off())
|
||||
goto err;
|
||||
}
|
||||
|
||||
if ((ca->clone_flags & CLONE_NEWPID) && setup_current_pid_ns())
|
||||
|
Loading…
x
Reference in New Issue
Block a user