Paul Gofman : ntdll: Don't reset rsp to context->Rsp until exception data is copied.
Alexandre Julliard
julliard at winehq.org
Thu Jul 2 15:04:32 CDT 2020
Module: wine
Branch: master
Commit: 69b6572338396134a3e20189cb35445d68757ebb
URL: https://source.winehq.org/git/wine.git/?a=commit;h=69b6572338396134a3e20189cb35445d68757ebb
Author: Paul Gofman <pgofman at codeweavers.com>
Date: Thu Jul 2 11:06:04 2020 +0300
ntdll: Don't reset rsp to context->Rsp until exception data is copied.
Context record may be stored on stack below context stack. This
happens, e. g., with RtlRaiseException().
Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/unix/signal_x86_64.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/dlls/ntdll/unix/signal_x86_64.c b/dlls/ntdll/unix/signal_x86_64.c
index 5334a4d7cc..cb0fdfb00f 100644
--- a/dlls/ntdll/unix/signal_x86_64.c
+++ b/dlls/ntdll/unix/signal_x86_64.c
@@ -1979,17 +1979,18 @@ __ASM_GLOBAL_FUNC( user_exception_dispatcher_trampoline,
void WINAPI do_call_user_exception_dispatcher(EXCEPTION_RECORD *rec, CONTEXT *context, struct stack_layout *stack)
{
- memcpy(&stack->context, context, sizeof(*context));
+ memmove(&stack->context, context, sizeof(*context));
memcpy(&stack->rec, rec, sizeof(*rec));
user_exception_dispatcher_trampoline( stack, pKiUserExceptionDispatcher );
}
__ASM_GLOBAL_FUNC( call_user_exception_dispatcher,
- "movq 0x98(%rdx),%rsp\n\t" /* context->Rsp */
- "and $~0xf,%rsp\n\t"
- "sub $0x630,%rsp\n\t" /* sizeof(struct stack_layout) */
- "movq %rsp,%r8\n\t"
+ "movq 0x98(%rdx),%r8\n\t" /* context->Rsp */
+ "andq $~0xf,%r8\n\t"
+ "subq $0x630,%r8\n\t" /* sizeof(struct stack_layout) */
+ "cmpq %r8,%rsp\n\t"
+ "cmovbq %r8,%rsp\n\t"
"jmp " __ASM_NAME("do_call_user_exception_dispatcher") "\n\t")
/***********************************************************************
More information about the wine-cvs
mailing list