Skip to content

Conversation

@dgreatwood
Copy link
Collaborator

EventMethEpollEquivImpl::ctlEx now locks interest_mutex_ when performing its add/mod/del actions.

Previously, the interest_mutex_ lock was released before these add/mod/del actions were performed. This was confirmed to occasionally cause a "use after free" in findEmEventInAnInterestSet (called out of getReadyEmEvents) in another thread. It might also result in corruption of the interest_ std::set.

This change affects the code path only when libevent is used.

EventMethEpollEquivImpl::ctlEx now locks interest_mutex_ when
performing its add/mod/del actions.

Previously, the interest_mutex_ lock was released before these
add/mod/del actions were performed. This was confirmed to occasionally
cause a "use after free" in findEmEventInAnInterestSet (called out of
getReadyEmEvents) in another thread. It might also result in
corruption of the interest_ std::set.
@kiplingw
Copy link
Member

Good find @dgreatwood. There appears to be a small hiccup in CI on the macOS runner trying to get through the http_server_test.

@dgreatwood
Copy link
Collaborator Author

dgreatwood commented Aug 30, 2024 via email

@kiplingw kiplingw merged commit f71275b into pistacheio:master Aug 30, 2024
@Tachi107
Copy link
Member

Tachi107 commented Aug 30, 2024 via email

@kiplingw
Copy link
Member

Sorry @Tachi107. @dgreatwood and I discussed offline prior to merging. Next time I'll wait longer for additional eyeballs to test and review.

@dgreatwood
Copy link
Collaborator Author

dgreatwood commented Aug 30, 2024 via email

@dgreatwood dgreatwood deleted the ProtectInterestInctlExAccess branch January 18, 2025 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants