Skip to contentSkip to conversation

UDP recvmsg blocks after select(), 2.6 bug?

DISCUSSION [email protected] 2 participants 2 messages Oct 7, 2004 – Oct 9, 2004

lore
Share & tools
lore
#0 lore raw
Quoted 6 lines

There is one claim I'd like to question - the claim that select() would be slowed down unnecessarily, even if the behaviour was changed for both O_NONBLOCK enabled. Isn't it more expensive to allow the application to be woken up, and poll using read(), than to just do a quick check in the kernel and not tell the application there is data, when there really isn't?

It depends on how often the second check fails.

The 99.9+% case is that the checksum is good, and in that case, you have to pay the wakeup cost anyway. (So sending bad-checksum packets isn't even a useful DoS; good-checksum packets still steal more cycles.)

You only get the benefit of saving the wakeup if the check fails. But every time it passes, you get the benefit of making the check cheaper. You have to multiply by the relative probabilities to see the net effect.

For something like UDP checksums on packets which have already passed the ethernet checksum, that's a pretty overwhelming ratio.

#1 lore raw

So the performance gain is significant. And programs that break were buggy anyway. But that still leaves the question of whether it benefits users, given that there is a lot of software, buggy by this interpretation, that can break. In particular, exposing UDP daemons to denial of service using bad-checksum UDP packets looks like a rather interesting security issue.

I have just tried syslog and inetd on a couple of machines running 2.6.8.1, and both hang when given a single bad-checksum udp packet. hping2 -2 -c 1 -b is the tool of choice. Sure, they could have broken anyway, but this makes them easy targets - and presumably they are the tip of the iceberg.

Signature · 1 line
Colin Phipps <[email protected]>