freebsd-src/lib/libc
John Polstra e2e3d0a401 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
1999-11-18 03:01:06 +00:00
..
alpha In longjmp, call sigreturn instead of osigreturn. The latter isn't 1999-10-14 01:16:51 +00:00
amd64 Remove osig* from NOASM. It bogus now. 1999-10-14 10:00:39 +00:00
compat-43 Fix sigvec(). When the sigset_t changes came in, it was altered 1999-10-09 00:25:29 +00:00
db $Header$ -> $FreeBSD$ 1999-08-28 05:11:36 +00:00
gen Make setproctitle(NULL) restore all of the original arguments 1999-11-17 21:12:17 +00:00
gmon $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
i386 Remove osig* from NOASM. It bogus now. 1999-10-14 10:00:39 +00:00
include $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
locale Fix dead loop if locale contains / and not all categories specified 1999-11-09 11:09:16 +00:00
mips Bring in initial libc support for mips. These files were taken from 1999-03-03 07:06:17 +00:00
mipseb Fix all the mipseb Makefiles. They were broken when I checked them in 1999-04-22 07:16:11 +00:00
mipsel Fix all the mipseb Makefiles. They were broken when I checked them in 1999-04-22 07:16:11 +00:00
net Add unsigned char cast to isalpha 1999-11-04 05:01:28 +00:00
nls Add gencat(1) to SEE ALSO section. 1999-09-22 22:44:42 +00:00
quad $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
regex $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
rpc For the TCP transport, put the listening socket in non-blocking 1999-11-18 03:01:06 +00:00
stdio Add unsigned char cast to isdigit 1999-11-04 04:57:05 +00:00
stdlib Typo 1999-11-15 03:13:23 +00:00
stdtime Decremement by 1 the value taken for %j before assigning it to tm_yday, 1999-11-10 14:40:59 +00:00
string Add HISTORY. 1999-10-29 16:50:22 +00:00
sys Properly document what ENOENT really means for kldfind(2). 1999-11-14 18:15:33 +00:00
xdr $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
yp $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Makefile sigset_t change (part 5 of 5) 1999-09-29 15:18:46 +00:00
Makefile.inc $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00