Re: UDP recvmsg blocks after select(), 2.6 bug?

From: Chris Friesen
Date: Fri Oct 15 2004 - 20:01:33 EST


David Schwartz wrote:

The CAVEAT is that 'select', like every other status information function
provided by the kernel, does not guarantee anything about the future. Just
like 'stat' does not guarantee that the file size will still be the same
later when you call 'read'.

This is not a very good counterexample. If I'm the only one accessing a file, then the file size should not just change all by itself.

As you say, select is level triggered. However, the very definition of select returning a file descriptor as readable is that a subsequent read will not block. This seems very straightforward. Maybe it's not the best from a performance point of view, but it's very straightforward.

So if we change the semantics slightly to say that select returning readable really means a subsequent *blocking* read will not block, then apps that use blocking sockets will get proper semantics, and apps using nonblocking reads will get full performance.

As it stands, it's fairly straightforward to do a DOS and hang various apps with a single corrupt packet each. This is suboptimal.

Chris
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/