Bug 462553

Summary: -mpreferred-stack-boundary=2 on 32 bit x86 causes crashes when SSE is also enabled (e.g. used by glibc)
Product: [Developer tools] valgrind Reporter: Alexander Kanavin <alex.kanavin>
Component: generalAssignee: Julian Seward <jseward>
Status: REPORTED ---    
Severity: crash CC: pjfloyd, rwmacleod, sam
Priority: NOR    
Version First Reported In: 3.20.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Alexander Kanavin 2022-12-02 16:33:05 UTC
Valgrind build itself with -mpreferred-stack-boundary=2 on x86 (32 bit) targets. On the other hand,  SSE instructions expect things to be aligned on 16 byte boundary (e.g. -mpreferred-stack-boundary=4). This won't be reported at compile time and results in crashes at runtime, e.g. vgdb simply does not work at all and crashes out immediately when calling into glibc code which moves things to and from XMM registers (because it was built with SSE enabled).
Comment 1 Paul Floyd 2022-12-05 09:07:36 UTC
What platform / glibc version is this with?
Comment 2 Alexander Kanavin 2022-12-05 09:55:10 UTC
Yocto/qemux86. We use the following flags across the stack:

-march=core2 -mtune=core2 -msse3 -mfpmath=sse

glibc is at 2.36.