This is based on patch 2790759 from Kevin Springborn. His comments on
sourceforge:
Problem:
The failure case is as follows: Event is added using epoll_add (a
direct pointer is stored in the user_data section), epoll_recalc is
called and the fds array is moved (invalidating the user_data
pointer stored in epoll). epoll_dispatch is called for the added
event and accesses evepoll based on the invalid pointer (set before
the fds array was relocated).
Solution:
Dispatch has access to the epollop structure, so given the fd we can
find the corresponding evepoll struct. Use data.fd instead of
data.ptr and store the fd corresponding to the event. This way when
epoll_recalc moves the fds array (and updates the fds array pointer
in epollop), the evepoll calculation in dispatch still finds the
valid evepoll struct.
svn:r1282