[9153] in bugtraq
Re: NetBSD Security Advisory 1999-001: select(2)/accept(2) race
daemon@ATHENA.MIT.EDU (Richard Kettlewell)
Thu Jan 21 14:31:47 1999
Date: Thu, 21 Jan 1999 10:35:00 +0000
Reply-To: Richard Kettlewell <richardk@CHIARK.GREENEND.ORG.UK>
From: Richard Kettlewell <richardk@CHIARK.GREENEND.ORG.UK>
To: BUGTRAQ@NETSPACE.ORG
In-Reply-To: Luke Mewburn's message of Wed, 20 Jan 1999 18:32:02 GMT
Luke Mewburn <lukem@GOANNA.CS.RMIT.EDU.AU> writes:
> Many TCP servers open a TCP socket in the default blocking mode, use
> select(2) to wait for connections, and then accept(2) connections in
> blocking mode. Under some circumstances, the accept(2) may hang
> waiting for another connection, denying service to clients trying to
> connect to other ports.
[...]
> Two solutions are possible:
>
> 1) Modify all TCP servers to use non-blocking listening sockets.
> Unfortunately, this requires changing a large amount of code, much
> of it maintained by third parties.
This has been in the UNIX Sockets FAQ for quite some time:
http://kipper.york.ac.uk/~vic/sock-faq/sfaq.html#faq16
| On some other implementations, accept seemed to be capable of
| blocking if this occured. This is important, since if select() said
| the listening socket was readable, then you would normally expect
| not to block in the accept() call. The fix is, of course, to set
| nonblocking mode on the listening socket if you are going to use
| select() on it.
ttfn/rjk