LWN.net Logo

GNU + Linux = broken development model

GNU + Linux = broken development model

Posted Jul 29, 2009 20:02 UTC (Wed) by nix (subscriber, #2304)
In reply to: GNU + Linux = broken development model by mheily
Parent article: A tempest in a tty pot

And if TTY code was that easy to grep for, maybe it would be simple: we
have distributors who can point to such code.

But it is not. TTY users can be people who accept file descriptors via
pipes and have no idea there are TTYs at the other end: they can be people
who use the Unix98 or the old BSD pty interface (which still has users!);
every use of ioctl() has to be audited: the signal handling in TTY users
has to be checked; it ties in with process groups...

The TTY stuff introduced in the early BSD Unix is, let's be blunt, a
bloody design mess, and a pervasive one. It's not a nice simple <pty.h>
interface, by any means, although it should have been.


(Log in to post comments)

Passing fds via pipes?!

Posted Jul 30, 2009 0:01 UTC (Thu) by i3839 (guest, #31386) [Link]

> TTY users can be people who accept file descriptors via
> pipes and have no idea there are TTYs at the other end

How is this possible? Did you mean unix domain sockets instead of pipes?

Passing fds via pipes?!

Posted Jul 30, 2009 0:37 UTC (Thu) by nix (subscriber, #2304) [Link]

Wrong way round. An fd to a TTY can be passed over a unix-domain socket
and then used (which will trigger line discipline magic even though the
app has no idea it's using it), so it's using a TTY even though it never
opened it or looked at /dev/ptmx. (This is probably not common, but it
makes a comprehensive audit of TTY users ridiculously hard, because use of
AF_UNIX sockets *is* common and fd passing is not particularly rare. One
variation of it, in which the fd is passed into the application as one of
fds 0 to 2, is of course exceedingly common. You don't even need AF_UNIX
sockets for that.)

Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds