Re: how is recv(..., MSG_PEEK) racy?
From: David S. Miller
Date: Tue Sep 23 2003 - 02:44:27 EST
On Tue, 23 Sep 2003 12:15:45 +0530
Abhijit Menon-Sen <ams@xxxxxxx> wrote:
> While fetchmail doesn't seem to be triggering that printk(), I'm curious
> about what the race condition is. Google found a post by DaveM saying it
> has something to do with URG data, but without any further details. I'd
> appreciate any explanation of the problem(s).
If multiple threads do reads to the same socket, one using
MSG_PEEK and one without, there is a race because the thread
doing MSG_PEEK doesn't expect the bytes it is "peeking" at
to be removed from the receive queue from the socket, but that
is exactly what the other thread will do.
When using URG data, the kernel becomes the "other thread doing
non-MSG_PEEK reads" on the socket. So if you use MSG_PEEK and
URG data at the same time, you will likely trigger the race and
that printk() alerting you to this fact.
-
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/