gh-119999: Fix potential race condition in _Py_ExplicitMergeRefcount#120000
Merged
colesbury merged 1 commit intoJun 4, 2024
Conversation
…efcount` We need to write to `ob_ref_local` and `ob_tid` before `ob_ref_shared`. Once we mark `ob_ref_shared` as merged, some other thread may free the object because the caller also passes in `-1` as `extra` to give up its only reference.
pimzero
added a commit
to pimzero/cpython
that referenced
this pull request
Jun 3, 2024
…s.*Selector.select` Since f70e1ca, and following PEP-475, `select.select` (and calls to other multiplexing syscalls in the `select` module) should not raise `InterruptedError`. However, if a signal happen and interrupts the `select` syscall in `select.select`, and it raises an exception (uncaught in the signal handler), then the `select` syscall will returns `-EINTR`, `PyErr_CheckSignals()` returns -1 and we don't retry the `select` syscall, the exception being forwarded to the `select.select` caller (in our case, `selectors.SelectSelector.select`. It is an issue if the exception raised in the signal handler is `InterruptedError`: given `selectors.SelectSelector.select` catches this exception and returns an empty list, it is not possible to differentiate between a timeout and a `InterruptedError` exception raised in a signal handler (additionally, this exception is not propagated)
_Py_ExplicitMergeRefcount_Py_ExplicitMergeRefcount
corona10
approved these changes
Jun 4, 2024
|
Thanks @colesbury for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Jun 4, 2024
…fcount` (pythonGH-120000) We need to write to `ob_ref_local` and `ob_tid` before `ob_ref_shared`. Once we mark `ob_ref_shared` as merged, some other thread may free the object because the caller also passes in `-1` as `extra` to give up its only reference. (cherry picked from commit 4055577) Co-authored-by: Sam Gross <colesbury@gmail.com>
|
GH-120073 is a backport of this pull request to the 3.13 branch. |
colesbury
added a commit
that referenced
this pull request
Jun 4, 2024
…efcount` (GH-120000) (#120073) We need to write to `ob_ref_local` and `ob_tid` before `ob_ref_shared`. Once we mark `ob_ref_shared` as merged, some other thread may free the object because the caller also passes in `-1` as `extra` to give up its only reference. (cherry picked from commit 4055577) Co-authored-by: Sam Gross <colesbury@gmail.com>
barneygale
pushed a commit
to barneygale/cpython
that referenced
this pull request
Jun 5, 2024
…fcount` (python#120000) We need to write to `ob_ref_local` and `ob_tid` before `ob_ref_shared`. Once we mark `ob_ref_shared` as merged, some other thread may free the object because the caller also passes in `-1` as `extra` to give up its only reference.
noahbkim
pushed a commit
to hudson-trading/cpython
that referenced
this pull request
Jul 11, 2024
…fcount` (python#120000) We need to write to `ob_ref_local` and `ob_tid` before `ob_ref_shared`. Once we mark `ob_ref_shared` as merged, some other thread may free the object because the caller also passes in `-1` as `extra` to give up its only reference.
estyxx
pushed a commit
to estyxx/cpython
that referenced
this pull request
Jul 17, 2024
…fcount` (python#120000) We need to write to `ob_ref_local` and `ob_tid` before `ob_ref_shared`. Once we mark `ob_ref_shared` as merged, some other thread may free the object because the caller also passes in `-1` as `extra` to give up its only reference.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We need to write to
ob_ref_localandob_tidbeforeob_ref_shared. Once we markob_ref_sharedas merged, some other thread may free the object because the caller also passes in-1asextrato give up its only reference._Py_ExplicitMergeRefcount#119999