-
-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
Possible heap-use-after-free
in ctypes in Python 3.12
#113576
Comments
The reproducer is actually quite easy. It is enough to initialize and deinitialize Python interpreter twice in the same process.
I arrived at this by simplifying my original test at https://github.com/skupperproject/skupper-router/blob/cfc8b4c6892dafc5dd0c86682b4db87a488f2451/tests/c_unittests/test_router_startup.cpp#L25 |
heap-use-after-free
and attempting free on address which was not malloc()-ed
warnings from AddressSanitizer in Python 3.12 -debugheap-use-after-free
and attempting free on address which was not malloc()-ed
warnings from AddressSanitizer in embedded Python 3.12 -debug
cc @pablogsal |
This looks like an issue in |
heap-use-after-free
and attempting free on address which was not malloc()-ed
warnings from AddressSanitizer in embedded Python 3.12 -debugheap-use-after-free
in ctypes in Python 3.12
@sobolevn @pablogsal here's a suspected culprit from git-bisect
So the culprit seems to be from this PR from two years ago, by @ericsnowcurrently Full git-bisect log:
|
This should be resolved in main and in the 3.13 branch, since we did the work to isolate |
Crash report
What happened?
I have a binary which is embedding python. I want to test this binary with address sanitizer, and leak sanitizer. Regular python3.12 build contained in Fedora 39 causes lsan to report leaks even with
PYTHONMALLOC=malloc_debug
, which with previous versions gave me clean run.Therefore, I tried
python3-debug
, which is a debug build of python packaged in Fedora. With that, I hitand I was playing around a bit. When I hit the mentioned issue, I was using PYTHONMALLOC="malloc_debug". I wanted to try other values for this variable. With
pymalloc_debug
, I got the same assertion.With
malloc
, I gotand with
pymalloc
I got a different traceDoes this look like a Python bug? I'd be happy to attempt a reproducer if the backtraces are deemed sufficiently interesting and worth investigating.
CPython versions tested on:
3.12
Operating systems tested on:
Linux
Output from running 'python -VV' on the command line:
Tasks
The text was updated successfully, but these errors were encountered: