Skip to content

Commit

Permalink
Fix: Lock interest_mutex_ When interest_ Modified in ctlEx
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dgreatwood committed Aug 30, 2024
1 parent eddff16 commit 4ac4d56
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/common/eventmeth.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4037,6 +4037,8 @@ EmEventTmrFd::EmEventTmrFd(clockid_t clock_id,

if (ctl_res == 0)
{
GUARD_AND_DBG_LOG(interest_mutex_);

switch(op)
{
case EvCtlAction::Add:
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.4.1.20240828
0.4.2.20240829

0 comments on commit 4ac4d56

Please sign in to comment.