Skip to content

gh-100795: avoid unexpected freeaddrinfo after failed getaddrinfo #101010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2,258 commits into from

Conversation

sebres
Copy link
Contributor

@sebres sebres commented Jan 13, 2023

Proposed PR fixes segfault gh-100795 - avoid unexpected freeaddrinfo if res becomes not NULL during invocation of getaddrinfo if it fails.
Previously this could cause double freeing and other hardly reproducible aftereffects, especially in multithreaded environment.

One could surely do return -1 instead of res = NULL & goto fail (in second case), like in

return -1;

but this way it is minimal invasive (more consistent, remains safe against some merges or future implementations expecting goto fail to free some other handles, etc).

miss-islington and others added 30 commits March 15, 2022 08:50
…pes.guess_type (pythonGH-30229)

(cherry picked from commit 5dd7ec5)

Co-authored-by: Kumar Aditya <[email protected]>
)

Co-authored-by: Zachary Ware <[email protected]>.
Co-authored-by: Christian Heimes <[email protected]>.
Co-authored-by: Christian Heimes <[email protected]>
…non-zero exit code when part of the build fails (pythonGH-31921) (pythonGH-31927)

Automerge-Triggered-By: GH:zooba
…H-30891) (pythonGH-30894)

Add the following info to test.pythoninfo:

* windows.ver: output of the shell "ver" command
* windows.version and windows.version_caption: output of the
  "wmic os get Caption,Version /value" command.

(cherry picked from commit b0898f4)

* bpo-45382: test.pythoninfo: set wmic.exe encoding to OEM (pythonGH-30890)

(cherry picked from commit cef0a54)
(cherry picked from commit 4a57fa2)

Co-authored-by: Victor Stinner <[email protected]>
…ioTestCase (pythonGH-31946)

(cherry picked from commit 3dd9bfa)

Co-authored-by: Andrew Svetlov <[email protected]>
(cherry picked from commit dbbe4d2)

Co-authored-by: Serhiy Storchaka <[email protected]>
We were using os_helper, which doesn't exist on 3.9. This wasn't
caught because the test is only run as root. I confirmed that when
run as root, the test previously failed and now passes.
…e modes when argument is '-' (pythonGH-13165) (pythonGH-31979)

Also made modes containing 'a' or 'x' act the same as a mode containing 'w' when argument is '-'
(so 'a'/'x' return sys.stdout like 'w', and 'ab'/'xb' return sys.stdout.buffer like 'wb').
(cherry picked from commit eafec26)

Co-authored-by: MojoVampire <[email protected]>
(cherry picked from commit cb7874f)

Co-authored-by: andrei kulakov <[email protected]>
A warning about inline flags not at the start of the regular
expression now contains the position of the flag.
(cherry picked from commit 4142961)

Co-authored-by: Serhiy Storchaka <[email protected]>
) (pythonGH-32002)

Clarifies a versionchanged note on crc32 & adler32 docs that the workaround is only needed for Python 2 and earlier.
Also cleans up an unnecessary intermediate variable in the implementation.

Authored-By: Ma Lin / animalize
Co-authored-by: Gregory P. Smith <[email protected]>
(cherry picked from commit 6d290d5)

Co-authored-by: Ma Lin <[email protected]>
)

The `_SharedFile` tracks its own virtual position into the file as
`self._pos` and updates it after reading or seeking. `tell()` should
return this position instead of calling into the underlying file object,
since if multiple `_SharedFile` instances are being used concurrently on
the same file, another one may have moved the real file position.
Additionally, calling into the underlying `tell` may expose thread
safety issues in the underlying file object because it was called
without taking the lock.
(cherry picked from commit e730ae7)

Co-authored-by: Kevin Mehall <[email protected]>
…-32013) (pythonGH-32015)

Inputs >= 4GiB to `binascii.crc32(...)` when compiled to use the zlib
crc32 implementation (the norm on POSIX) no longer return the wrong
result.

(cherry picked from commit 4c989e1)
…s of the specified exception type (pythonGH-32027) (pythonGH-32035)

(cherry picked from commit 45833b5)
…1910) (pythonGH-32049)

Co-authored-by: Kumar Aditya <[email protected]>.
(cherry picked from commit 32e7715)

Co-authored-by: Andrew Svetlov <[email protected]>
…ythonGH-26578)

Replace the child process `typeperf.exe` with a daemon thread that reads the performance counters directly.  This prevents the issues that arise from inherited handles in grandchild processes (see issue37531 for discussion).

We only use the load tracker when running tests in multiprocess mode. This prevents inadvertent interactions with tests expecting a single threaded environment.  Displaying load is really only helpful for buildbots running in multiprocess mode anyway..

Co-authored-by: Jeremy Kloth <[email protected]>
…12 (pythonGH-31891) (python#31998)

Document the deprecation of asyncore, asynchat, and smtpd with a slated removal in Python 3.12 thanks to PEP 594..
(cherry picked from commit 7747384)

Co-authored-by: Hugo van Kemenade <[email protected]>
…31932)

Co-authored-by: Piet Delport
Co-authored-by: Hugo Lopes Tavares
Co-authored-by: Jelle Zijlstra <[email protected]>
(cherry picked from commit 7ba7eae)

Co-authored-by: Daniël van Noord <[email protected]>
@cjw296
Copy link
Contributor

cjw296 commented Jan 21, 2023

Please base this off main

@cjw296 cjw296 closed this Jan 21, 2023
@sebres
Copy link
Contributor Author

sebres commented Jan 21, 2023

I know therefore I wrote that a rebase is needed.
This happens if development takes places in branches independently without any interim merge point to mainline.
Please reopen, I'll cherry pick that commits main-based.

@sebres
Copy link
Contributor Author

sebres commented Jan 21, 2023

OK, the branch is main-based now.
You can reopen it or forget it (because I don't understand why your time should be more valuable than my).
As I saw this chaos I marked this PR as draft, there was no reason at all to close it.

@arhadthedev
Copy link
Member

there was no reason at all to close it.

Apologises if the swift closure appeared to be rude. GitHub fails to update PR's Commits and Files Changed tabs if a push creates massive changes. So it's way easier to create a new PR for a fixed branch instead of trying to somehow reset notifications and the tabs.

@arhadthedev
Copy link
Member

By the way, branch miscreation happens regularily in the CPython repo so closing and recreation anew became a standard (and default / someway unquestionable) practice.

@vsajip
Copy link
Member

vsajip commented Jan 21, 2023

branch miscreation happens regularily in the CPython repo

Yes, because new contributors apparently have missed this bit in the documentation ("Lifecycle of a Pull Request"):

Here is a quick overview of how you can contribute to CPython:

  • Create an issue that describes your change
  • Create a new branch in Git from the main branch

(later steps omitted)

@sebres
Copy link
Contributor Author

sebres commented Jan 21, 2023

OK, new PR #101220 is there now.
FWIW, as already said, few simplest interim merge-marks of primary branches to each other up to main (simple merge-points of 3.9 -> 3.10 -> 3.11 -> main, without data/conflicts resolution, just to obtain new common ancestor, e. g. after some releases) could help again such kind of disaster, avoid large unmerged trees again and again and prevent such a chaos on GH side (regardless intentional or by possible user confusion)... let alone it'd help people actively developing against different branches or else often switching them (to find a bug source or target branch to backport, to bisect, blame etc pp).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.