[Devel] Re: BUG in tty_open when using containers and ptrace

Grzegorz Nosek root at localdomain.pl
Fri Jul 24 00:31:58 PDT 2009


On Thu, Jul 23, 2009 at 03:11:50PM -0700, H. Peter Anvin wrote:
> Nothing, but as long as something is keeping the pts file entry open, it
>  should not be garbage-collected.

The pts is opened after the parent (holding the master side) exits, so the
ptm is not going away from under us while we have the pts open -- it's no
longer there at open() time.

The lifetime rules and relations for master tty_struct, slave tty_struct
and the corresponding devpts inode are still not completely clear to me
(what is holding what alive etc.), so I want to be 100% sure we're on the
same page.

In this case it looks like the ttys are gone but the inode still keeps a
pointer to the pts tty_struct. So we can either:
 1. overwrite the pointer with -EIO or something
 2. extend the life of the ttys to match the inode

As the end result from userspace perspective is the same (we have to
error out when opening the pts anyway -- as you implied above), I'd go for
the simpler (1).

BTW, I was mistaken about experimenting with the dentry refcount -- I
did it the other way around (tty_kref_get while creating the inode
IIRC). Sorry for the confusion.

Best regards,
 Grzegorz Nosek
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list