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 mpmcq use-after-free bug #4541

Merged
merged 1 commit into from
Nov 22, 2024

Conversation

dipinhora
Copy link
Contributor

according to address sanitizer, prior to this commit, the mpmcq node free could cause a use-after-free error from another thread that might still be reading from tail->next. This was technically safe in this context since the logic will end up looping due to the CAS failing in the while condition due to the aba counter being out of sync.

This commit defers freeing of the nodes and instead recycles them for future pushes onto the mpmcq from the same thread to ensure that there are no use-after-free concerns any longer.

according to address sanitizer, prior to this commit, the mpmcq node
free could cause a use-after-free error from another thread that
might still be reading from `tail->next`. This was technically safe
in this context since the logic will end up looping due to the CAS
failing in the while condition due to the aba counter being out of
sync.

This commit defers freeing of the nodes and instead recycles them
for future pushes onto the mpmcq from the same thread to ensure
that there are no use-after-free concerns any longer.
@ponylang-main ponylang-main added the discuss during sync Should be discussed during an upcoming sync label Nov 22, 2024
@SeanTAllen SeanTAllen merged commit b5decba into ponylang:main Nov 22, 2024
24 checks passed
@ponylang-main ponylang-main removed the discuss during sync Should be discussed during an upcoming sync label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants