Skip to content

gh-117657: Fix data race in _Py_IsImmortal #118261

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

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

mpage
Copy link
Contributor

@mpage mpage commented Apr 24, 2024

The load of ob_ref_local:

return (op->ob_ref_local == _Py_IMMORTAL_REFCNT_LOCAL);

races with stores (example):

_Py_atomic_store_uint32_relaxed(&op->ob_ref_local, local);

Using a relaxed load is sufficient; stores to the field are relaxed.

@colesbury colesbury merged commit f14e9f9 into python:main Apr 25, 2024
39 checks passed
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.

2 participants