[CRIU] Re: [PATCH 03/10] tty: Fix tty inheritance in case if zero sid fetched

Pavel Emelyanov xemul at parallels.com
Fri Oct 26 16:10:16 EDT 2012


On 10/26/2012 11:57 PM, Cyrill Gorcunov wrote:
> 
> In case if at checkpoint time we've fetched zero sid
> associated with tty peer it doesn't obligatory means
> that we've met a hangig up terminal, in particular
> zero sid may be obtained if the slave peer do not
> belong to the session the task run in but inherited
> from the parent.

I don't understand this. Kernel:

static int tiocgsid(struct tty_struct *tty, struct tty_struct *real_tty, pid_t __user *p)
{               
        /*
         * (tty == real_tty) is a cheap way of
         * testing if the tty is NOT a master pty.
        */      
        if (tty == real_tty && current->signal->tty != real_tty)
                return -ENOTTY;
        if (!real_tty->session)
                return -ENOTTY;
        return put_user(pid_vnr(real_tty->session), p);
}       

If sid is set it's reported regardless of who reads it.

> Thus if --shell-job passed we should
> handle such situation gracefully.
> 
> [ https://bugzilla.openvz.org/show_bug.cgi?id=2405 ]
> 
> Reported-by: Andrey Vagin <avagin at openvz.org>
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  tty.c |   14 +++++++++++++-
>  1 files changed, 13 insertions(+), 1 deletions(-)
> 




More information about the CRIU mailing list