From owner-cvs-all Wed Nov 17 19: 1:11 1999 Delivered-To: cvs-all@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id A396714C95; Wed, 17 Nov 1999 19:01:08 -0800 (PST) (envelope-from jdp@FreeBSD.org) Received: (from jdp@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id TAA78698; Wed, 17 Nov 1999 19:01:08 -0800 (PST) (envelope-from jdp@FreeBSD.org) Message-Id: <199911180301.TAA78698@freefall.freebsd.org> From: John Polstra Date: Wed, 17 Nov 1999 19:01:08 -0800 (PST) To: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/lib/libc/rpc svc_tcp.c Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk jdp 1999/11/17 19:01:08 PST Modified files: lib/libc/rpc svc_tcp.c Log: For the TCP transport, put the listening socket in non-blocking mode. This addresses a well-known race condition that can cause servers to hang in accept(). The relevant case is when somebody connects to the server and then immediately kills the connection by sending a TCP reset. On the server this causes select to report a ready condition on the socket, after which the accept call blocks because there is no longer any pending connection to accept. In -current there is already a work-around for this in the kernel. It was merged into -stable some time ago, but then David Greenman reverted it because it seemed to be causing a socket leak in some cases. (See uipc_socket.c revision 1.51.2.3.) Hence this userland fix is needed in -stable, and I plan to merge it into that branch soon because it fixes a potential DoS attack. It may also be needed in -current if the suspected socket leak turns out to be real. In any case, after thinking it over I believe the fix belongs in userland. An application shouldn't assume that a ready return from select guarantees that the subsequent I/O operation cannot block. A lot can happen between the select and the accept. A similar fix should most likely be applied to the Unix domain socket transport too. Submitted by: peter Reviewed by: jdp Revision Changes Path 1.16 +19 -1 src/lib/libc/rpc/svc_tcp.c To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message