[CRIU] Re: [PATCH 03/10] tty: Fix tty inheritance in case if zero
sid fetched
Cyrill Gorcunov
gorcunov at openvz.org
Fri Oct 26 16:15:49 EDT 2012
On Sat, Oct 27, 2012 at 12:10:16AM +0400, Pavel Emelyanov wrote:
> 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.
No, note the "current" here. If the reader belongs to another
session you'll get -ENOTTY.
More information about the CRIU
mailing list