Subject: Re: kern/30815 -- CVS commit: src/sys/kern (tty.c:1.174)
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: Frank Kardel <Frank.Kardel@Acrys.COM>
List: netbsd-bugs
Date: 07/23/2005 16:52:01
The following reply was made to PR kern/30815; it has been noted by GNATS.

From: Frank Kardel <Frank.Kardel@Acrys.COM>
To: Christos Zoulas <christos@astron.com>
Cc: current-users@NetBSD.org, Geoff Wing <mason@primenet.com.au>,
	gnats-bugs@NetBSD.org
Subject: Re: kern/30815 -- CVS commit: src/sys/kern (tty.c:1.174)
Date: Sat, 23 Jul 2005 18:13:31 +0200

 Christos Zoulas wrote:
 
 >In article <slrndd42e8.kr.mason@g.primenet.com.au>,
 >Geoff Wing  <mason@primenet.com.au> wrote:
 >  
 >
 >>Christos Zoulas <christos@netbsd.org> typed:
 >>: Modified Files:
 >>: 	src/sys/kern: tty.c
 >>: Log Message:
 >>: Allow F{G,S}OWN to succeed on a tty that has no session associated with it,
 >>: and it is not the controlling tty. This change allows us to use SIGIO on
 >>: a non-controlling tty (eg. debug ntpd with a refclock on a tty).
 >>
 >>This has killed my com port mouse under XFree 4.5.0 (i386).  Previously
 >>with a working mouse /var/log/XFree86.0.log would have
 >> (WW) fcntl(6, F_SETOWN): Inappropriate ioctl for device
 >>
 >>Anything obvious to anyone else?  (before I have to kickstart my brain)
 >>    
 >>
 >
 >I don't know, it seems to me that before it was returning EPERM, and now
 >it is returning EINVAL. It should have been failing before too.
 >
 >christos
 >
 >  
 >
 It also breaks ntpd in its new form (no CTTY allocation) - see 
 kern/30815 for details.
 
 Problem is that pgsignal() is called with an arg3 of 1 (=check tty) 
 meaning that signal
 should only be posted to processes having a controlling termical 
 (P_CONTROLT flag
 in p->p_flag).
 Thus there is he second check for a CTTY.
 Looking at the code I think it is enough to call pgsignal with arg3 = 0 
 (no check
 for P_CONTROLT) in ttwakeup() as SIGIO is sent there.
 
 All other uses of pgsignal with arg3=1
 are ok as those signals should ONLY be sent to processes with a P_CONTROLT
 flag set. (SIGINT, SIGQUIT, SIGTSTP, SIGINFO, SIGTTOU, SIGWINCH, SIGTTIN).
 
 Is this analysis correct ? If so it should resolve the issues with X and 
 ntpd.
 
 Frank