diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2024-05-10 15:13:17 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-10 15:13:17 (GMT) |
commit | 0becae366c9d0b98d3f53849098e76bc8b1ef574 (patch) | |
tree | 909a8c366796ea07aa38db34e1f785a3c4a81412 /Include | |
parent | 0874a400a86c563cff71847f35674d4e1bcc3957 (diff) | |
download | cpython-0becae366c9d0b98d3f53849098e76bc8b1ef574.zip cpython-0becae366c9d0b98d3f53849098e76bc8b1ef574.tar.gz cpython-0becae366c9d0b98d3f53849098e76bc8b1ef574.tar.bz2 |
[3.13] gh-117657: Fix QSBR race condition (GH-118843) (#118905)
`_Py_qsbr_unregister` is called when the PyThreadState is already
detached, so the access to `tstate->qsbr` isn't safe without locking the
shared mutex. Grab the `struct _qsbr_shared` from the interpreter
instead.
(cherry picked from commit 33d20199af65c741bdc908a968edd8dc179b6974)
Co-authored-by: Alex Turner <alexturner@meta.com>
Diffstat (limited to 'Include')
-rw-r--r-- | Include/internal/pycore_qsbr.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Include/internal/pycore_qsbr.h b/Include/internal/pycore_qsbr.h index c3680a2..20e643e 100644 --- a/Include/internal/pycore_qsbr.h +++ b/Include/internal/pycore_qsbr.h @@ -140,7 +140,7 @@ _Py_qsbr_register(struct _PyThreadStateImpl *tstate, // Disassociates a PyThreadState from the QSBR state and frees the QSBR state. extern void -_Py_qsbr_unregister(struct _PyThreadStateImpl *tstate); +_Py_qsbr_unregister(PyThreadState *tstate); extern void _Py_qsbr_fini(PyInterpreterState *interp); |