[PATCH] winecrt0: Do not expect jmp_buf to be aligned in __wine_longjmp on x86_64.

Paul Gofman pgofman at codeweavers.com
Tue Jul 14 03:17:50 CDT 2020

On 7/14/20 10:35, Alexandre Julliard wrote:
> Paul Gofman <pgofman at codeweavers.com> writes:
>> On 7/13/20 23:05, Alexandre Julliard wrote:
>>> Paul Gofman <pgofman at codeweavers.com> writes:
>>>> There is no guarantee that jmp_buf is 16 bytes aligned.
>>> It is using DECLSPEC_ALIGN(16) though. Where do you see it being
>>> misaligned?
>> Well, I was getting that after turning NtOpenDirectoryObject locally
>> into syscall thunk from  __TRY / __CATCH block used by IsBadStringPtrW()
>> from debugstr_w(). But after you pointed out that alignment is there
>> which I initially missed, I found that the stack alignment which is
>> present in syscall thunk generated code seems not to be performed
>> (apparently, not intentionally) if the size of arguments is <= 0x20. I
>> should rather be fixing that, sorry for the noise.
> Fixing that wouldn't hurt, but note that all API functions should
> already be using force_align_arg_pointer. If that doesn't work correctly
> we'll have other problems.
The stack is not aligned in Mingw PE modules for some reason (I checked
with a winehq binary also that is not my local build problem only; I
also checked by explicitly setting it for function to make sure it is
not some configuration problem). It is aligned in .so though, my local
problem here was due to making syscall thunks for still PE Nt functions.
Yet failure to align stack in Staging syscall thunks back then was
breaking builds on some systems even with .so ntdll [1].

1. https://bugs.winehq.org/show_bug.cgi?id=48274

More information about the wine-devel mailing list