[CRIU] Re: [PATCH 14/14] tty, restore: Migrate tty slave peer connection

Pavel Emelyanov xemul at parallels.com
Mon Oct 15 12:12:33 EDT 2012


On 10/15/2012 06:54 PM, Cyrill Gorcunov wrote:
> 
> In case if we've dumped a slave peer only (say a user dumped
> `top' application) we should migrate it on current active
> terminal, which barely an own standart stream prepared for us
> by the file engine.
> 
> Note only one external slave peer is allowed simply because
> otherwise we can't distinguish which indices should be used
> for each of them.
> 
> The patch basically does the following things
> 
>  - rename pty_open_fake_ptmx to pty_open_unpaired_slave
>    because we might be inheriting SELF_STDIN_OFF instead
>    of opening fake master peer
> 
>  - Do inherit SELF_STDIN_OFF and restore tty group if
>    we are restoring external tty
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  tty.c |   66 ++++++++++++++++++++++++++++++++++++++++++++++++++--------------
>  1 files changed, 51 insertions(+), 15 deletions(-)
> 


> +	if (likely(slave->tie->termios)) {
> +		fd = dup(get_service_fd(SELF_STDIN_OFF));
> +		if (fd < 0) {
> +			pr_perror("Can't dup SELF_STDIN_OFF");
> +			return -1;
> +		}
> +		pr_info("Migrated slave peer %x -> to fd %d\n",
> +			slave->tfe->id, fd);

Presence of termios on _proper_ slaves denotes a corruption in the image. You turn
this into a sign that a slave is unpaired, which is wrong.


More information about the CRIU mailing list