[PATCH v2 1/2] ntdll: Fix context arch flag cleanup for AMD64 in context_from_server().

Paul Gofman pgofman at codeweavers.com
Wed Nov 24 09:06:39 CST 2021


Signed-off-by: Paul Gofman <pgofman at codeweavers.com>
---
    In particular, fixes a semi-random crash in ntdll exception test (test_extended_context) I am now
    reproducing locally. The thread is created suspended while the main thread sets
    context to it. (to_flags & CONTEXT_AMD64_XSTATE) is always TRUE.

 dlls/ntdll/unix/thread.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c
index 38a03bd4b60..00261edb593 100644
--- a/dlls/ntdll/unix/thread.c
+++ b/dlls/ntdll/unix/thread.c
@@ -755,7 +755,7 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma
     {
         AMD64_CONTEXT *to = dst;
 
-        to_flags = to->ContextFlags & ~CONTEXT_i386;
+        to_flags = to->ContextFlags & ~CONTEXT_AMD64;
         if ((from->flags & SERVER_CTX_CONTROL) && (to_flags & CONTEXT_AMD64_CONTROL))
         {
             to->ContextFlags |= CONTEXT_AMD64_CONTROL;
@@ -830,7 +830,7 @@ static NTSTATUS context_from_server( void *dst, const context_t *from, USHORT ma
     {
         AMD64_CONTEXT *to = dst;
 
-        to_flags = to->ContextFlags & ~CONTEXT_i386;
+        to_flags = to->ContextFlags & ~CONTEXT_AMD64;
         if ((from->flags & SERVER_CTX_CONTROL) && (to_flags & CONTEXT_AMD64_CONTROL))
         {
             to->ContextFlags |= CONTEXT_AMD64_CONTROL;
-- 
2.33.1




More information about the wine-devel mailing list