[New-bugs-announce] [issue35350] importing "ctypes" immediately causes a segmentation fault

David report at bugs.python.org
Thu Nov 29 10:17:47 EST 2018


New submission from David <raging.blaze at gmail.com>:

~Environment

Cross compiled Python 2.7.15 for ARM Cortex-A7 target, Linux Kernel 4.18

uname -a: Linux Test-0002 4.18.13 #1 SMP Wed Oct 31 11:20:07 CET 2018 armv7l GNU/Linux

~Description of the problem

Importing the "ctypes" module in order to load shared libraries causes a segmentation fault:

root [ /tmpfs/root ] $ python
Python 2.7.15 (default, Nov 29 2018, 13:57:56)
[GCC 8.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
Segmentation fault

I have found a similiar issue here:
https://bugs.python.org/issue11048
But the changes are already applied in 2.7.15.

Here is the GDB output similiar to the link I posted:

(gdb) file python2.7
Reading symbols from python2.7...done.
(gdb) run -c "import ctypes"
Starting program: /usr/bin/python2.7 -c "import ctypes"
warning: Unable to find libthread_db matching inferior's thread library, thread debugging will not be available.

Program received signal SIGSEGV, Segmentation fault.
0x76a4fa94 in CThunkObject_dealloc (_self=0x76adb920) at /home/user/ARM_Linux/src/Python-2.7.15/Modules/_ctypes/callbacks.c:25
25      /home/user/ARM_Linux/src/Python-2.7.15/Modules/_ctypes/callbacks.c: No such file or directory.
(gdb)

>From what I can see it tries to use the path from the host I cross compiled for the callbacks.c. Is this the cause of the segmentation fault? If yes, how can I correct the path during compilation?

I also attached the strace log of the command 'python -c "import ctypes"'

Thank you in advance!

----------
components: ctypes
files: strace_python.log
messages: 330696
nosy: n0s69z
priority: normal
severity: normal
status: open
title: importing "ctypes" immediately causes a segmentation fault
type: crash
versions: Python 2.7
Added file: https://bugs.python.org/file47954/strace_python.log

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35350>
_______________________________________


More information about the New-bugs-announce mailing list