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.
Peter
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu