BUG in tty_open when using containers and ptrace

Grzegorz Nosek root at localdomain.pl
Thu Jul 23 00:47:36 PDT 2009

On śro, lip 22, 2009 at 06:48:55 -0700, H. Peter Anvin wrote:
> > | Bisecting...

2.6.27 is good, 2.6.28 is bad. Some 600-odd revisions still to go (will
continue in the evening).

> Interesting... I have to say I'm more than a bit surprised that you can
> mount a filesystem on top of a character device node at all, but there
> isn't really a fundamental reason why you couldn't do it, so...

Actually it's mounting a device node over a device node. I was really
surprised when I learnt that you can mount --bind other things than
directories but thought it could be the closest a container can get to a
real console. So mounting /dev/pts/0 over /dev/console seemed quite
natural to me.

> I am assuming that what causes the problem is that you have found a way
> (vfsmount) to hold the pts device node busy which doesn't involve the
> tty subsystem.  This isn't inherently a problem, but it does have
> implications for freeing: in particular, the pts node cannot be removed
> until the vfsmount is gone, *and* the device number cannot be reclaimed.
>  It sounds like it's the latter piece which causes problems.

Upthread I posted a patch[1] that makes tty_driver_lookup_tty() return
NULL (later changed to ERR_PTR(-EIO) and verified it works) in such a
case. If the inode can (as you say) legally outlive its matching tty_struct,
I guess the patch should go in. If it cannot, well, the patch is bogus.

Best regards,
 Grzegorz Nosek

[1] https://lists.linux-foundation.org/pipermail/containers/2009-July/019141.html

More information about the Containers mailing list