From owner-freebsd-net@FreeBSD.ORG Tue Jun 22 23:13:14 2004 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7480B16A4CE; Tue, 22 Jun 2004 23:13:14 +0000 (GMT) Received: from fledge.watson.org (fledge.watson.org [204.156.12.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id 13D3143D5D; Tue, 22 Jun 2004 23:13:14 +0000 (GMT) (envelope-from robert@fledge.watson.org) Received: from fledge.watson.org (localhost [127.0.0.1]) by fledge.watson.org (8.12.11/8.12.11) with ESMTP id i5MNBLc3061539; Tue, 22 Jun 2004 19:11:21 -0400 (EDT) (envelope-from robert@fledge.watson.org) Received: from localhost (robert@localhost)i5MNBJlf061536; Tue, 22 Jun 2004 19:11:19 -0400 (EDT) (envelope-from robert@fledge.watson.org) Date: Tue, 22 Jun 2004 19:11:19 -0400 (EDT) From: Robert Watson X-Sender: robert@fledge.watson.org To: Bruce M Simpson In-Reply-To: <20040622225021.GH762@empiric.dek.spc.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-net@freebsd.org cc: bms@empiric.dek.spc.org cc: freebsd-gnats-submit@freebsd.org Subject: Re: kern/45733: file descriptor flags and socket flags out of sync X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Jun 2004 23:13:14 -0000 On Tue, 22 Jun 2004, Bruce M Simpson wrote: > I applied the attached patch to -CURRENT from around April which is > currently running on my local CVS server. Basic tests with sshd and ftp > didn't result in any unexpected behaviour. I suspect I really need to be > running an application similar to the one Jayanth is running to unravel > things further. > > Can anyone more familiar with the socket layer than I think of any > problems with applying it? > > Can anyone think of an application (e.g. in ports) which takes the same > order of operations as that described in the PR? Interesting problem. :-) Comments on the patch below. > Index: uipc_syscalls.c > =================================================================== > RCS file: /home/ncvs/src/sys/kern/uipc_syscalls.c,v > retrieving revision 1.181 > diff -u -r1.181 uipc_syscalls.c > --- uipc_syscalls.c 8 Apr 2004 07:14:34 -0000 1.181 > +++ uipc_syscalls.c 22 Jun 2004 22:23:16 -0000 > @@ -320,6 +320,7 @@ > /* connection has been removed from the listen queue */ > KNOTE(&head->so_rcv.sb_sel.si_note, 0); > > + so->so_state |= head->so_state; > so->so_state &= ~SS_COMP; > so->so_head = NULL; > pgid = fgetown(&head->so_sigio); Hmm. Maybe we should just copy SS_NBIO? The other SS_ flags seem inappropriate to copy. I looked at SS_ASYNC, but we fail to also propagate the socket buffer flags and it's not clear it's as meaningful, so I think just SS_NBIO. So perhaps: so->so_state |= (head->so_state & SS_NBIO); Robert N M Watson FreeBSD Core Team, TrustedBSD Projects robert@fledge.watson.org Senior Research Scientist, McAfee Research