Skip to content

Conversation

@mpage
Copy link
Contributor

@mpage mpage commented Apr 25, 2024

Use relaxed atomics when reading / writing to the field. There are still a few places in the GC where we do not use atomics. Those should be safe as the world is stopped.

Sample races reported by TSAN:

mpage added 2 commits April 25, 2024 11:36
Use relaxed atomics when reading / writing to the field. There are still a
few places in the GC where we do not use atomics. Those should be safe as
the world is stopped.

Sample races reported by TSAN:

* [Race between `_PyObject_GC_IS_SHARED()` and `_PyObject_GC_SET_SHARED()`](https://gist.github.com/mpage/ebfd022773f39c33bec68c0993a2249e)
* [Race between `_PyObject_GC_TRACK()` and `_PyObject_GC_IS_SHARED()`](https://gist.github.com/mpage/b53b5c22a2f923bf1571b887bb31ef88)
@mpage mpage requested a review from DinoV April 25, 2024 20:42
@mpage mpage marked this pull request as ready for review May 7, 2024 17:26
@mpage mpage requested a review from colesbury May 7, 2024 17:26
@colesbury colesbury added the needs backport to 3.13 bugs and security fixes label May 8, 2024
@colesbury colesbury merged commit cb6f75a into python:main May 8, 2024
@miss-islington-app
Copy link

Thanks @mpage for the PR, and @colesbury for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 8, 2024
…ythonGH-118292)

Use relaxed atomics when reading / writing to the field. There are still a
few places in the GC where we do not use atomics. Those should be safe as
the world is stopped.
(cherry picked from commit cb6f75a)

Co-authored-by: mpage <mpage@meta.com>
@bedevere-app
Copy link

bedevere-app bot commented May 8, 2024

GH-118796 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label May 8, 2024
colesbury pushed a commit that referenced this pull request May 8, 2024
…H-118292) (#118796)

Use relaxed atomics when reading / writing to the field. There are still a
few places in the GC where we do not use atomics. Those should be safe as
the world is stopped.
(cherry picked from commit cb6f75a)

Co-authored-by: mpage <mpage@meta.com>
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