mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-25 02:58:54 +00:00
tty: Make sure the controlling terminal is restored by session leader
The controling terminal should be sestored by a session leader, thus we need to test if the SID we've found in process tree is a leader. Otherwise we might have pretty interesting situation: the user passed -j on dump, ie telling us to inherit shell jobs and on restore procedure the SID get inherited from the crtools but session leader for this sid doesn't belong to our peocess tree and thus we should not try to restore controlling terminal but inherit it as well. Reported-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Acked-by: Andrey Vagin <avagin@openvz.org> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
parent
ed5f540c99
commit
4cff708663
1 changed files with 6 additions and 1 deletions
7
tty.c
7
tty.c
|
|
@ -733,8 +733,13 @@ static int tty_find_restoring_task(struct tty_info *info)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find out the task which is session leader
|
||||
* and it can restore the controlling terminal
|
||||
* for us.
|
||||
*/
|
||||
item = find_first_sid(info->tie->sid);
|
||||
if (item) {
|
||||
if (item && item->pid.virt == item->sid) {
|
||||
pr_info("Set a control terminal %x to %d\n",
|
||||
info->tfe->id, info->tie->sid);
|
||||
return prepare_ctl_tty(item->pid.virt,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue