mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-01 06:45:35 +00:00
restore: call close_old_fds() before forking children
If processes share a file descriptor table, they all have their own set
of service descriptors. close_old_fds() closes all file descriptors
execpt service descriptors
Fixes: 9d60724eca
("restore: restore mntns before creating private vma-s (v3)")
Signed-off-by: Andrew Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
committed by
Pavel Emelyanov
parent
7017181849
commit
e95fd98b12
11
cr-restore.c
11
cr-restore.c
@@ -1504,6 +1504,12 @@ static int restore_task_with_children(void *_arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!(ca->clone_flags & CLONE_FILES)) {
|
||||||
|
ret = close_old_fds(current);
|
||||||
|
if (ret)
|
||||||
|
goto err_fini_mnt;
|
||||||
|
}
|
||||||
|
|
||||||
/* Restore root task */
|
/* Restore root task */
|
||||||
if (current->parent == NULL) {
|
if (current->parent == NULL) {
|
||||||
if (restore_finish_stage(CR_STATE_RESTORE_NS) < 0)
|
if (restore_finish_stage(CR_STATE_RESTORE_NS) < 0)
|
||||||
@@ -1553,11 +1559,6 @@ static int restore_task_with_children(void *_arg)
|
|||||||
if (create_children_and_session())
|
if (create_children_and_session())
|
||||||
goto err_fini_mnt;
|
goto err_fini_mnt;
|
||||||
|
|
||||||
if (!(ca->clone_flags & CLONE_FILES)) {
|
|
||||||
ret = close_old_fds(current);
|
|
||||||
if (ret)
|
|
||||||
goto err_fini_mnt;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unmap_guard_pages())
|
if (unmap_guard_pages())
|
||||||
goto err_fini_mnt;
|
goto err_fini_mnt;
|
||||||
|
Reference in New Issue
Block a user