mirror of https://github.com/python/cpython
gh-117657: Fix TSAN race in QSBR assertion (#119887)
Due to a limitation in TSAN, all reads from `PyThreadState.state` must be atomic to avoid reported races.
This commit is contained in:
parent
60593b2052
commit
90ec19fd33
|
@ -160,7 +160,8 @@ qsbr_poll_scan(struct _qsbr_shared *shared)
|
||||||
bool
|
bool
|
||||||
_Py_qsbr_poll(struct _qsbr_thread_state *qsbr, uint64_t goal)
|
_Py_qsbr_poll(struct _qsbr_thread_state *qsbr, uint64_t goal)
|
||||||
{
|
{
|
||||||
assert(_PyThreadState_GET()->state == _Py_THREAD_ATTACHED);
|
assert(_Py_atomic_load_int_relaxed(&_PyThreadState_GET()->state) == _Py_THREAD_ATTACHED);
|
||||||
|
|
||||||
if (_Py_qbsr_goal_reached(qsbr, goal)) {
|
if (_Py_qbsr_goal_reached(qsbr, goal)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,8 +75,6 @@ race_top:_PyFrame_GetCode
|
||||||
race_top:_PyFrame_Initialize
|
race_top:_PyFrame_Initialize
|
||||||
race_top:PyInterpreterState_ThreadHead
|
race_top:PyInterpreterState_ThreadHead
|
||||||
race_top:_PyObject_TryGetInstanceAttribute
|
race_top:_PyObject_TryGetInstanceAttribute
|
||||||
race_top:_Py_qsbr_unregister
|
|
||||||
race_top:_Py_qsbr_poll
|
|
||||||
race_top:PyThreadState_Next
|
race_top:PyThreadState_Next
|
||||||
race_top:Py_TYPE
|
race_top:Py_TYPE
|
||||||
race_top:PyUnstable_InterpreterFrame_GetLine
|
race_top:PyUnstable_InterpreterFrame_GetLine
|
||||||
|
|
Loading…
Reference in New Issue