lkml.org 
[lkml]   [2003]   [Sep]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: how is recv(..., MSG_PEEK) racy?
On Tue, 23 Sep 2003 12:15:45 +0530
Abhijit Menon-Sen <ams@wiw.org> 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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:48    [W:0.030 / U:0.404 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site