[PATCH] ntdll: Always align stack in call_user_apc_dispatcher() on x86_64.

Paul Gofman pgofman at codeweavers.com
Mon Oct 12 18:52:18 CDT 2020


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49860
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
---
    Context passed to NtContinue() (which calls the faulting APC in the
    referenced bug's app) is the initial thread context. The fault
    itself is in combase.CoCreateInstance() which happens to
    use xmm0 for transferring arguments on stack.

 dlls/ntdll/unix/signal_x86_64.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c
index e11b2c70b59..00b07c4270c 100644
--- a/dlls/ntdll/unix/signal_x86_64.c
+++ b/dlls/ntdll/unix/signal_x86_64.c
@@ -2011,6 +2011,7 @@ __ASM_GLOBAL_FUNC( call_user_apc_dispatcher,
                    "jrcxz 1f\n\t"
                    "movq 0x98(%rcx),%rax\n\t"       /* context_ptr->Rsp */
                    "leaq -0x5c0(%rax),%rsp\n\t"     /* sizeof(CONTEXT) + offsetof(frame,ret_addr) */
+                   "andq $~15,%rsp\n\t"
                    "jmp 2f\n"
                    "1:\tmovq 0x328(%rbx),%rax\n\t"  /* amd64_thread_data()->syscall_frame */
                    "leaq -0x4d0(%rax),%rsp\n\t"
-- 
2.26.2




More information about the wine-devel mailing list