2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 14:25:49 +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:
Andrew Vagin
2015-11-15 09:07:04 +03:00
committed by Pavel Emelyanov
parent 7017181849
commit e95fd98b12

View File

@@ -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 */
if (current->parent == NULL) {
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())
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())
goto err_fini_mnt;