Repository navigation
Calling many methods on _ssl._SSLSocket() segfaults #126455
Description
Activity
- addedtype-crashA hard crash of the interpreter, possibly with a core dumpA hard crash of the interpreter, possibly with a core dump
on Nov 5, 2024 - addedextension-modulesC modules in the Modules dirC modules in the Modules dir3.12only security fixesonly security fixes3.13only security fixesonly security fixes3.14bugs and security fixesbugs and security fixes
on Nov 5, 2024 I can probably deal with this considering my previous work with
_ssl, unless someone else really wants to.Seems not to be related to free-threading, given being present in many previous versions.
Reacted by Peter Bierma and Petr ViktorinI can probably deal with this considering my previous work with
_ssl, unless someone else really wants to.If you don't mind, can you give it to me :)
The problem is that it's possible to create an invalid SSLSocket:
$ ./python -c 'import _ssl; _ssl._SSLSocket().context' Erreur de segmentation (core dumped)In the Python implementation, there is:
class SSLSocket(socket): def __init__(self, *args, **kwargs): raise TypeError( f"{self.__class__.__name__} does not have a public " f"constructor. Instances are returned by " f"SSLContext.wrap_socket()." )
Maybe the _ssl extension module needs a similar constructor.
If you don't mind, can you give it to me :)
@rruuaanng: No, please do not. I suggest you instead focus on the many PRs you already have opened. Only when you're down to a handful of open PR, consider again to open a new PR.
Reacted by RUANG (James Roy) and Victor StinnerI wrote #126481 to fix the issue.
Reacted by Peter Bierma- added a commit that references this issue
on Nov 6, 2024 Fixed. Thanks for the bug report.
Thanks for working on this!
Crash report
What happened?
Calling many different methods on a
_ssl._SSLSocket()instance causes a segfault, for example:Other methods known to segfault are
do_handshake,get_channel_binding,get_verified_chain(but notget_unverified_chain),getpeercert,read,verify_client_post_handshake,write. Backtrace looks like:Found using fusil by @vstinner.
CPython versions tested on:
3.10, 3.11, 3.12, 3.13, 3.14, CPython main branch
Operating systems tested on:
Linux, Windows
Output from running 'python -VV' on the command line:
Python 3.14.0a1+ experimental free-threading build (heads/main-dirty:bfc1d2504c, Nov 4 2024, 07:55:58) [GCC 11.4.0]
Linked PRs