kern/45733: file descriptor flags and socket flags out of sync
Robert Watson
rwatson at freebsd.org
Tue Jun 22 23:13:14 GMT 2004
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 at fledge.watson.org Senior Research Scientist, McAfee Research
More information about the freebsd-net
mailing list