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
"import ctypes" segfaults on Python 3.6 and Ubuntu 21.10 #89911
Comments
3.7 and later are all working fine. First good commit: 55fe1ae git checkout v3.6.15 #0 0x00007ffff6cc52a0 in PyCFuncPtr_new (type=0x5555559157f8, args=0x7ffff6ce6dd8, kwds=0x0)
#1 0x00005555556400f9 in type_call (type=0x5555559157f8, args=0x7ffff6ce6dd8, kwds=0x0) at Objects/typeobject.c:895 #2 0x00005555555db4ca in _PyObject_FastCallDict (func=0x5555559157f8, args=0x7ffff6dc1f48, nargs=1, kwargs=0x0) at Objects/abstract.c:2331 #3 0x00005555556b8e7c in call_function (pp_stack=pp_stack@entry=0x7fffffffcb58, oparg=<optimized out>, kwnames=kwnames@entry=0x0)
#4 0x00005555556bc9d3 in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3335 #5 0x00005555556b774c in PyEval_EvalFrameEx (throwflag=0, f=0x7ffff6dc1dc8) at Python/ceval.c:754 #6 _PyFunction_FastCall (co=<optimized out>, args=<optimized out>, nargs=nargs@entry=0, globals=<optimized out>) at Python/ceval.c:4933 #7 0x00005555556b9269 in fast_function (kwnames=0x0, nargs=0, stack=<optimized out>, func=0x7ffff6d78378) at Python/ceval.c:4968 #8 call_function (pp_stack=pp_stack@entry=0x7fffffffccf8, oparg=<optimized out>, kwnames=kwnames@entry=0x0) at Python/ceval.c:4872 #9 0x00005555556bc9d3 in _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3335 #10 0x00005555556b83c7 in PyEval_EvalFrameEx (throwflag=0, f=0x5555558d2248) at Python/ceval.c:754 #11 _PyEval_EvalCodeWithName (_co=_co@entry=0x7ffff6cdf660, globals=globals@entry=0x7ffff6dfa438, locals=locals@entry=0x7ffff6dfa438, args=args@entry=0x0, argcount=argcount@entry=0, kwnames=kwnames@entry=0x0, kwargs=0x0, kwcount=0, defs=0x0, defcount=0, kwdefs=0x0,
closure=0x0, name=0x0, qualname=0x0, kwstep=2) at Python/ceval.c:4166 #12 0x00005555556b9a25 in PyEval_EvalCodeEx (closure=0x0, kwdefs=0x0, defcount=0, defs=0x0, kwcount=0, kws=0x0, argcount=0, args=0x0, locals=0x7ffff6dfa438, globals=0x7ffff6dfa438, _co=0x7ffff6cdf660) at Python/ceval.c:4187 #13 PyEval_EvalCode (co=co@entry=0x7ffff6cdf660, globals=globals@entry=0x7ffff6dfa438, locals=locals@entry=0x7ffff6dfa438)
#14 0x00005555556b611d in builtin_exec_impl (module=<optimized out>, locals=0x7ffff6dfa438, globals=0x7ffff6dfa438, source=0x7ffff6cdf660)
#15 builtin_exec (module=<optimized out>, args=<optimized out>) at Python/clinic/bltinmodule.c.h:283 #16 0x000055555562b651 in PyCFunction_Call (func=func@entry=0x7ffff6eb7990, args=args@entry=0x7ffff6cdcd08, kwds=kwds@entry=0x7ffff6d6b288)
#17 0x00005555556c11af in do_call_core (kwdict=0x7ffff6d6b288, callargs=0x7ffff6cdcd08, func=0x7ffff6eb7990) at Python/ceval.c:5116 #18 _PyEval_EvalFrameDefault (f=<optimized out>, throwflag=<optimized out>) at Python/ceval.c:3404 #19 0x00005555556b8d17 in PyEval_EvalFrameEx (throwflag=0, f=0x7ffff6dc2930) at Python/ceval.c:754 #20 _PyEval_EvalCodeWithName (_co=0x7ffff6eabdb0, globals=<optimized out>, locals=<optimized out>, args=<optimized out>, argcount=3, kwnames=0x0, kwargs=0x7ffff6d913c8, kwcount=0, kwstep=1, defs=0x0, defcount=0, kwdefs=0x0, closure=0x0, name=0x7ffff6e53ad0,
qualname=0x7ffff6e53ad0) at Python/ceval.c:4166 |
Python 3.6 is in security-fix only mode. I'm sorry, but I don't think this counts as a security issue. |
And besides that, it's not clear what problem you are reporting without more context. As far as I can tell, neither the "good" nor the "bad" commit ids you reference are in or were backported to the 3.6 branch. Without more information, it is hard to speculate, however one thing that *might* be relevant is the version of libffi you are trying to use. There have been several issues reported against other branches of Python when trying to use libffi's recent 3.4.2 release. In any case, as Erlend noted, this doesn't appear to be a security-related issue; in general, changes for newer versions of operating systems or third-party libraries are out-of-scope for Python versions in the security-fix phase of their life cycles. |
FWIW, I'm seeing what I think is this problem on Ubuntu 22.04 LTS, using Python 3.6.15, and Ubuntu's libffi 3.4.2-4. The simple repro is to start the interpreter, and import setuptools.
I haven't yet dug through 3.7+ to see what might have fixed it: if I manage to find a solution, I'll report it here. |
@da4089 3.7 got its last bugfix release on June, 2020. Nowadays, only security vulnerabilities are fixed; the rest is set in stone. However, the fix (if applied) will be welcomed on 3.10, the oldest version with bugs being fixed until June, 2023. |
Quoting #89911 (comment):
|
Hi @arhadthedev -- yes, I understand 3.6 is not supported, but some people are required to use it for various reasons, and this issue seemed like the best place to record both confirmations of the issue, and potential fixes or workarounds. I hope that's ok? FWIW, I have found a workaround that works for my problem: import ctypes before setuptools. This seems potentially useful, since it appears to work while not requiring a change to the interpreter (which, as you point out, isn't going to get a new release).
But, if ctypes is imported first ...
|
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: