netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* epoll_wait misses edge-triggered eventfd events: bug in Linux 5.3 and 5.4
@ 2020-01-31 13:57 Max Neunhoeffer
  2020-02-01 20:16 ` Jakub Kicinski
  0 siblings, 1 reply; 7+ messages in thread
From: Max Neunhoeffer @ 2020-01-31 13:57 UTC (permalink / raw)
  To: netdev

Dear All,

I believe I have found a bug in Linux 5.3 and 5.4 in epoll_wait/epoll_ctl
when an eventfd together with edge-triggered or the EPOLLONESHOT policy
is used. If an epoll_ctl call to rearm the eventfd happens approximately
at the same time as the epoll_wait goes to sleep, the event can be lost, 
even though proper protection through a mutex is employed.

The details together with two programs showing the problem can be found
here:

  https://bugzilla.kernel.org/show_bug.cgi?id=205933

Older kernels seem not to have this problem, although I did not test all
versions. I know that 4.15 and 5.0 do not show the problem.

Note that this method of using epoll_wait/eventfd is used by
boost::asio to wake up event loops in case a new completion handler
is posted to an io_service, so this is probably relevant for many
applications.

Any help with this would be appreciated.

Cheers,
  Max.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-02-04 10:35 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-31 13:57 epoll_wait misses edge-triggered eventfd events: bug in Linux 5.3 and 5.4 Max Neunhoeffer
2020-02-01 20:16 ` Jakub Kicinski
2020-02-03 15:15   ` Max Neunhoeffer
2020-02-03 16:48     ` Jakub Kicinski
2020-02-03 17:33     ` Roman Penyaev
2020-02-03 21:03       ` Max Neunhöffer
2020-02-04 10:35         ` Roman Penyaev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).