Skip to content

gh-117657: Fix data race in _Py_IsImmortal - #118261

Merged
colesbury merged 1 commit into
python:mainfrom
mpage:gh-117657-is-immortal
Apr 25, 2024
Merged

colesbury merged 1 commit into
python:mainfrom
mpage:gh-117657-is-immortal

Conversation

@mpage

@mpage mpage commented Apr 24, 2024 •

Copy link
Copy Markdown
Contributor

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants