lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 13 Dec 2012 19:15:02 -0500
From:	Phil Turmel <philip@...mel.org>
To:	Eric Wong <normalperson@...t.net>
CC:	Andreas Voellmy <andreas.voellmy@...e.edu>,
	viro@...iv.linux.org.uk, linux-fsdevel@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: epoll with ONESHOT possibly fails to deliver events

On 12/13/2012 07:08 PM, Phil Turmel wrote:
> On 12/13/2012 04:32 AM, Eric Wong wrote:
>> Andreas Voellmy <andreas.voellmy@...e.edu> wrote:
> 
> [trim /]
> 
>>>> Another thread, distinct from all of the threads serving particular
>>>> sockets, is perfoming epoll_wait calls. When sockets are returned as
>>>> being ready from an epoll_wait call, the thread signals to the
>>>> condition variable for the socket.
>>
>> Perhaps there is a bug in the way your epoll_wait thread
>> uses the condition variable to notify other threads?
> 
> Have you considered the possibility that data is arriving between
> epoll_ctl and pthread_cond_wait ?  If your monitoring thread returns
> from epoll_wait within this race window, it will call
> pthread_cond_signal while the first thread is not yet waiting for it.
> With the one-shot flag, the next iteration of epoll_wait won't see that
> socket's new data.

Let me clarify:

The read thread must perform the epoll_ctl between pthread_mutex_lock
and pthread_cond_wait, while the monitoring thread must hold the mutex
lock when signaling.

pthread_cond_signal and pthread_cond_broadcast don't require the caller
to hold the mutex in general, but your app needs it.

Phil

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ