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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user