Bugtraq mailing list archives
Re: NetBSD Security Advisory 1999-001: select(2)/accept(2) race
From: richardk () CHIARK GREENEND ORG UK (Richard Kettlewell)
Date: Thu, 21 Jan 1999 10:35:00 +0000
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
Current thread:
- Re: NetBSD Security Advisory 1999-001: select(2)/accept(2) race Richard Kettlewell (Jan 21)