mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
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.
This commit is contained in:
parent
31873bea47
commit
1d3cf79a50
9 changed files with 51 additions and 17 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue