Subject: Re: O_ASYNC on ttys
To: None <entropy@tappedin.com>
From: maximum entropy <entropy@tappedin.com>
List: tech-kern
Date: 07/07/2001 20:32:47
>Date: Sat, 7 Jul 2001 20:09:04 -0400 (EDT)
>From: maximum entropy <entropy@tappedin.com>
>
>After reading the thread in the archives, I'm not sure any of it is
>necessary.  O_ASYNC cares about the process group or PID indicated by
>an earlier call to fcntl(fd, F_SETOWN, pid) call, not the process
>group of a controlling tty.  So der Mouse should be able to get the
>SIGIO signals he wants without any kernel changes.  Below is an
>example using pipes.

Oh, crap.  I just read the code implementing F_SETOWN, and it does a
TIOCSPGRP internally, which will hit the security checks der Mouse is
complaining about.  Ouch.

Maybe the right thing to do is make fcntl(F_SETOWN) use FIOSETOWN
instead (see kern/sys_pipe.c).  Then the tty implementation of
FIOSETOWN could have the less restrictive process group checks, while
TIOCSPGRP retains the POSIX semantics.

--
entropy -- it's not just a good idea, it's the second law.