POSIX bashing
Guy Harris
guy at auspex.auspex.com
Thu Apr 4 05:01:13 AEST 1991
>The pty driver does not allow the master side to do an TIOCGPGRP on the
>slave side (as they are running in different process groups, and POSIX says
>that this should not happen for normal ttys). I found this in emacs,
>incidently. I made a kernel change to allow a new ioctl (TIOCSIG), which
>sends a specified signal to the process group on the slave side of the pty.
>However, it is rife with security holes, so I only used it myself. The
>folks at Berkeley did the same thing when I reported the "problem" to them,
>which was where I got the idea. rms claims, and there is some indication to
>back him up on this, that pty's are an extension, thus the TIOCGPGRP ioctl
>should be allowed to work.
Oh, I certainly agree. TIOCGPGRP on the master side of a pty should
report what process group the pty master is in, that process group being
the one to which a SIGIO is sent whenever I/O is possible on the master
side. TIOCSPGRP on the master side should set that process group.
That process group is, of course, completely independent of the process
group the *slave* is in.
TIOCSIG, or something like it, is the right answer if the process on the
master side has to send a signal to the slave side. If one is worried
about security, one can restrict it to sending SIGINT, SIGQUIT, and
SIGTSTP.
>(Note, btw, that my ioctl is better: if you are running an SUID process
>in the window, emacs cannot send any signal to it; with my change and
>kernel enhancement, it can.
Absolutely! Sending tty signals to the slave side of a pty by doing a
TIOCGPGRP and a "kill()" is the wrong answer.
More information about the Comp.unix.wizards
mailing list