[issue11048] "import ctypes" causes segfault on read-only filesystem

Marcin Bachry report at bugs.python.org
Sun Jan 30 16:50:34 CET 2011


Marcin Bachry <hegel666 at gmail.com> added the comment:

This patch fixes issue with unitialized variable which makes ctypes crash in error handler.

Note that for you it merely turns "Segmentation fault" into MemoryError exception.  Python ships with buggy version of libffi, which tries to allocate memory using mmap() over a temporary file (the one seen in strace output above) instead of just doing mmap(MAP_ANONYMOUS|MAP_PRIVATE).  The bug is fixed in this libffi commit:

  https://github.com/atgreen/libffi/commit/eaf444eabc4c78703c0f98ac0197b1619c1b1bef

Until Python's libffi is updated, you can do "mount -t tmpfs none /dev/shm".  It's good to have "tmpfs" mounted anyway, just like "proc" and "sysfs".

----------
keywords: +patch
nosy: +marcin.bachry
Added file: http://bugs.python.org/file20619/ctypes-erofs-crash.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11048>
_______________________________________


More information about the Python-bugs-list mailing list