Share

State Threads Library

Tracker: Patches

5 [amd64] segmentation fault on floating point (1.4, 1.8) - ID: 2847659
Last Update: Comment added ( mclap )

This patch fixes pass variables of double type via stack. E.g. when
calling
functions like printf(3). Actual only for AMD64.

st_thread_create() do the stack aligned, but after entering the thread
SP is 8-bytes aligned, but should 16-bytes at least.

Segmentation fault occurs inside function preamble on MOVAPS call.

This patch made for state-threads 1.4, but also applies to 1.8
without fuzz.

Futher testing shows perfect running on Linux/AMD64 and version of 1.8
also.


Pavel Plesov ( mclap ) - 2009-08-31 10:58

5

Open

None

Mike Abbott

None

None

Public


Comments ( 3 )




Date: 2009-10-02 06:57
Sender: mclap

st-1.4-amd64-stack-align-freebsd-linux.patch limits the fix for the only
platforms known to be affected and where the fix is tested.


Date: 2009-10-02 06:53
Sender: mclap

Unfortunately i know nothing about Darwin. I would like to limit the patch
using ifdef like:

#if defined(__amd64__) && (defined(FreeBSD) || defined(linux))

Updated patch file will follow.


Date: 2009-10-02 00:21
Sender: mabbottProject Admin

Thank you for your patch. Indeed, the AMD64 ABI requires (%rsp - 8) to be
16-byte aligned. Unfortunately your patch breaks other platforms, notably
x86_64 on Darwin. I searched for a way to detect when your patch is needed
and when it's not, but failed to find one. If you know of one please
update this bug with it.


Log in to comment.

Attached Files ( 2 )

Filename Description Download
st-1.4-amd64-stack-align.patch patch for 1.4 & 1.8 Download
st-1.4-amd64-stack-align-freebsd-linux.patch Download

Changes ( 4 )

Field Old Value Date By
File Added 345041: st-1.4-amd64-stack-align-freebsd-linux.patch 2009-10-02 06:53 mclap
assigned_to nobody 2009-10-02 00:21 mabbott
summary [amd64] segmentation fault on floating point 2009-08-31 10:58 mclap
File Added 341190: st-1.4-amd64-stack-align.patch 2009-08-31 10:58 mclap