Issue 17423: libffi on 32bit is broken on linux (original) (raw)

This issue has been migrated to GitHub: https://github.com/python/cpython/issues/61625

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, hodgestar, skrah, vstinner
Priority: normal Keywords: patch

Created on 2013-03-14 21:09 by fijall, last changed 2022-04-11 14:57 by admin. 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 (vstinner) * (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
2022-04-11 14:57:42 admin set github: 61625
2013-03-18 20:59:11 gregory.p.smith set superseder: ctypes libffi needs to align the x86 stack to 16 bytes
2013-03-18 20:58:36 gregory.p.smith set status: open -> closednosy: + gregory.p.smithmessages: + resolution: duplicate
2013-03-16 15:14:56 alex set messages: +
2013-03-16 14:39:57 fijall set messages: +
2013-03-16 14:28:05 fijall set messages: +
2013-03-16 13:41:23 vstinner set nosy: + vstinnermessages: +
2013-03-15 18:29:50 hodgestar set nosy: + hodgestar
2013-03-15 00:45:20 asvetlov set nosy: + asvetlov
2013-03-14 22:19:05 skrah set nosy: + skrahmessages: +
2013-03-14 21:29:24 alex set nosy: + alex
2013-03-14 21:11:30 fijall set files: + ffi.diffkeywords: + patch
2013-03-14 21:09:59 fijall set files: + x.c
2013-03-14 21:09:50 fijall set files: - x.c
2013-03-14 21:09:38 fijall set files: + x.py
2013-03-14 21:09:03 fijall create