Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Lock interest_mutex_ When interest_ Modified in ctlEx #1237

Merged
merged 1 commit into from
Aug 30, 2024

Conversation

dgreatwood
Copy link
Contributor

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
Contributor Author

dgreatwood commented Aug 30, 2024 via email

@kiplingw kiplingw merged commit f71275b into pistacheio:master Aug 30, 2024
123 of 132 checks passed
@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
Contributor Author

dgreatwood commented Aug 30, 2024 via email

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