lkml.org 
[lkml]   [1998]   [Apr]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: pty pairs in POXIX with devpts
C. Scott Ananian writes:
> On Tue, 28 Apr 1998 hpa@transmeta.com (H. Peter Anvin) wrote:
>
> > Followup to: <E0yTvTU-0006eI-00@taurus.cus.cam.ac.uk>
> > By author: pjb1008@cam.ac.uk (Peter Benie)
> > In newsgroup: linux.dev.kernel
> > >
> > > What does it do if both /dev/ptmx and /dev/pty?? devices exist?
> > >
> > > Suppose a user runs a program that allocates a pty by scanning the
> > > /dev/pty?? devices and chowning the corresponding slave device when it
> > > manages to open a pty master. The program may terminate without
> > > cleaning up. (Let's say the user sent it a SIGQUIT.) The master and
> > > slave sides of the pty are closed, so the pty can be allocated again,
> > > but the owner of the slave device remains as the user who started the
> > > program.
> > >
> > > Now suppose another user runs a program that allocates a pty using
> > > /dev/ptmx and /dev/pts/??. There's a good chance that it will get the
> > > pty from the program that just died. Now the pty slave is available
> > > twice - once to the correct user in /dev/pts, and once to somebody
> > > else as /dev/tty??.
> > >
> > > To make the device safe, you still have to use vhangup(), but now you
> > > have to locate the corresponding /dev/tty?? entry and chown it, even
> > > though you are using SysV-style pty allocation.
> > >
> > > IMO, it would be sensible for slave devices in /dev/pts to have a
> > > different major number so that the two allocation schemes were better
> > > separated from each other.
> > >
> >
> > This is a very good point. Obviously you can't allocate it twice, but
> > there is nastiness about having the two allocated from the same pool.
> > One possibility is to remove the restriction that you need to have
> > used /dev/ptmx in order for the device node to exist in /dev/pts, and
> > make all the /dev/tty?? entries symlinks to /dev/pts. Does anyone
> > know if that solution would work properly? I have a nasty feeling it
> > wouldn't.
>
> We dealt with this with devfs. IIRC, libc 5.X doesn't like symlinks to
> ttys. glibc might handle this better, I don't recall. Richard Gooch
> patched libc to work around this problem; I've cc'ed this message to him
> for his comments.

Libc 5.4.44 has this fix already. I haven't checked glibc 2.x, but I
did make Ulrich aware of the issue, and he said he'd take care of
it. Presumably glibc 2.x has a similar fix by now.

Adding a symlink farm to /dev is just going to uglify it further :-(

Regards,

Richard....
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu

\
 
 \ /
  Last update: 2005-03-22 13:42    [W:0.036 / U:0.436 seconds]
©2003-2014 Jasper Spaans. Advertise on this site