classification
Title: libffi on 32bit is broken on linux
Type: crash Stage:
Components: Versions:
process
Status: closed Resolution: duplicate
Dependencies: Superseder: ctypes libffi needs to align the x86 stack to 16 bytes
View: 17245
Assigned To: Nosy List: alex, asvetlov, fijall, gregory.p.smith, haypo, hodgestar, skrah
Priority: normal Keywords: patch

Created on 2013-03-14 21:09 by fijall, last changed 2013-03-18 20:59 by gregory.p.smith. This issue is now closed.

Files
File name Uploaded Description Edit
x.py fijall, 2013-03-14 21:09
x.c fijall, 2013-03-14 21:09
ffi.diff fijall, 2013-03-14 21:11 review
Messages (7)
msg184193 - (view) Author: Maciej Fijalkowski (fijall) * (Python committer) Date: 2013-03-14 21:09
The bug is a little tricky to reproduce. You need a 32bit linux. First compile x.c with:

gcc -O3 -g -shared -o x.so x.c -std=c99 -msse3 -ftree-vectorize -mfpmath=sse

and run x.py. It segfaults because the alignment of stack is not preserved (and it's assumed on a modern linux). Patch attached.
msg184201 - (view) Author: Stefan Krah (skrah) * (Python committer) Date: 2013-03-14 22:19
Is this the same as #17245?
msg184313 - (view) Author: STINNER Victor (haypo) * (Python committer) Date: 2013-03-16 13:41
libffi is not part of Python project, but Python has a copy for system which don't provide system libffi. You should report the issue upstream:
http://sourceware.org/libffi/

(Or is the issue already fixed upstream?)
msg184316 - (view) Author: Maciej Fijalkowski (fijall) * (Python committer) Date: 2013-03-16 14:28
The issue is reported upstrem and is/will be fixed
msg184318 - (view) Author: Maciej Fijalkowski (fijall) * (Python committer) Date: 2013-03-16 14:39
It's not "a copy for systems that don't provide libffi", since CPython makes zero effort to try to use system libffi if present.
msg184323 - (view) Author: Alex Gaynor (alex) * (Python committer) Date: 2013-03-16 15:14
The patch has been merged into libffi upstream: https://github.com/atgreen/libffi/pull/32
msg184520 - (view) Author: Gregory P. Smith (gregory.p.smith) * (Python committer) Date: 2013-03-18 20:58
I'm taking care of this with a libffi update per #17192 and #19245.  Thanks for the upstream fix into libffi 3.0.13 alex. :)
History
Date User Action Args
2013-03-18 20:59:11gregory.p.smithsetsuperseder: ctypes libffi needs to align the x86 stack to 16 bytes
2013-03-18 20:58:36gregory.p.smithsetstatus: open -> closed

nosy: + gregory.p.smith
messages: + msg184520

resolution: duplicate
2013-03-16 15:14:56alexsetmessages: + msg184323
2013-03-16 14:39:57fijallsetmessages: + msg184318
2013-03-16 14:28:05fijallsetmessages: + msg184316
2013-03-16 13:41:23hayposetnosy: + haypo
messages: + msg184313
2013-03-15 18:29:50hodgestarsetnosy: + hodgestar
2013-03-15 00:45:20asvetlovsetnosy: + asvetlov
2013-03-14 22:19:05skrahsetnosy: + skrah
messages: + msg184201
2013-03-14 21:29:24alexsetnosy: + alex
2013-03-14 21:11:30fijallsetfiles: + ffi.diff
keywords: + patch
2013-03-14 21:09:59fijallsetfiles: + x.c
2013-03-14 21:09:50fijallsetfiles: - x.c
2013-03-14 21:09:38fijallsetfiles: + x.py
2013-03-14 21:09:03fijallcreate