diff options
author | Alex Turner <alexturner@meta.com> | 2024-05-10 14:26:35 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-10 14:26:35 (GMT) |
commit | 33d20199af65c741bdc908a968edd8dc179b6974 (patch) | |
tree | d9172e4a7410ea8d80f87ca939683cb83e9d00f9 /Python/pystate.c | |
parent | 22d5185308f85efa22ec1e8251c409fe1cbd9e6b (diff) | |
download | cpython-33d20199af65c741bdc908a968edd8dc179b6974.zip cpython-33d20199af65c741bdc908a968edd8dc179b6974.tar.gz cpython-33d20199af65c741bdc908a968edd8dc179b6974.tar.bz2 |
gh-117657: Fix QSBR race condition (#118843)
`_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.
Diffstat (limited to 'Python/pystate.c')
-rw-r--r-- | Python/pystate.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Python/pystate.c b/Python/pystate.c index de6a768..0832b37 100644 --- a/Python/pystate.c +++ b/Python/pystate.c @@ -1794,7 +1794,7 @@ tstate_delete_common(PyThreadState *tstate) HEAD_UNLOCK(runtime); #ifdef Py_GIL_DISABLED - _Py_qsbr_unregister((_PyThreadStateImpl *)tstate); + _Py_qsbr_unregister(tstate); #endif // XXX Unbind in PyThreadState_Clear(), or earlier |