diff options
author | Sam Gross <colesbury@gmail.com> | 2024-07-08 18:52:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-08 18:52:07 (GMT) |
commit | 1d3cf79a501a93a7a488fc75d4db3060c5ee7d1a (patch) | |
tree | 2e2f59a0d466ee4abccae054281be060c578e094 /Modules/_testcapi | |
parent | 31873bea471020ca5deaf735d9acb0f1abeb1d3c (diff) | |
download | cpython-1d3cf79a501a93a7a488fc75d4db3060c5ee7d1a.zip cpython-1d3cf79a501a93a7a488fc75d4db3060c5ee7d1a.tar.gz cpython-1d3cf79a501a93a7a488fc75d4db3060c5ee7d1a.tar.bz2 |
gh-121368: Fix seq lock memory ordering in _PyType_Lookup (#121388)
The `_PySeqLock_EndRead` function needs an acquire fence to ensure that
the load of the sequence happens after any loads within the read side
critical section. The missing fence can trigger bugs on macOS arm64.
Additionally, we need a release fence in `_PySeqLock_LockWrite` to
ensure that the sequence update is visible before any modifications to
the cache entry.
Diffstat (limited to 'Modules/_testcapi')
-rw-r--r-- | Modules/_testcapi/pyatomic.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/Modules/_testcapi/pyatomic.c b/Modules/_testcapi/pyatomic.c index 4f72844..850de6f 100644 --- a/Modules/_testcapi/pyatomic.c +++ b/Modules/_testcapi/pyatomic.c @@ -125,6 +125,7 @@ test_atomic_fences(PyObject *self, PyObject *obj) { // Just make sure that the fences compile. We are not // testing any synchronizing ordering. _Py_atomic_fence_seq_cst(); + _Py_atomic_fence_acquire(); _Py_atomic_fence_release(); Py_RETURN_NONE; } |