summaryrefslogtreecommitdiffstats
path: root/Python/pystate.c
diff options
context:
space:
mode:
authorAlex Turner <alexturner@meta.com>2024-05-10 14:26:35 (GMT)
committerGitHub <noreply@github.com>2024-05-10 14:26:35 (GMT)
commit33d20199af65c741bdc908a968edd8dc179b6974 (patch)
treed9172e4a7410ea8d80f87ca939683cb83e9d00f9 /Python/pystate.c
parent22d5185308f85efa22ec1e8251c409fe1cbd9e6b (diff)
downloadcpython-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.c2
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