[PATCH 1/2] server: Discard existing Wow64 context when the client does not provide a new one.
Jinoh Kang
wine at gitlab.winehq.org
Tue May 24 10:36:12 CDT 2022
From: Jinoh Kang <jinoh.kang.kr at gmail.com>
Today, the wineserver does not discard the stale Wow64 context when the
client sends its new register context via the select request.
If a Wow64 process is in emulation mode (e.g. CS points to 32-bit compat
segment on x86-64), the Wow64 register context is synonymous to the
native register context. The client can indicate this condition by
omitting the Wow64 context when issuing a select request.
If the client does omit the Wow64 context, the server shall discard the
old Wow64 context which has now become stale; however, the server
leaves the Wow64 context slot unchanged. This becomes an issue if the
Wow64 context slot has already been populated by a prior select request
(e.g. a debug event).
Fix this by clearing the 'machine' and 'flags' fields of the Wow64
context slot unless a new Wow64 context is provided by the client.
Signed-off-by: Jinoh Kang <jinoh.kang.kr at gmail.com>
---
server/thread.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/server/thread.c b/server/thread.c
index 467ccd1f0db..c795df8ffa1 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -1616,11 +1616,16 @@ DECL_HANDLER(select)
ctx->regs[CTX_WOW].machine = current->process->machine;
copy_context( &ctx->regs[CTX_WOW], wow_context, wow_context->flags & ~ctx->regs[CTX_WOW].flags );
}
- else if (ctx->regs[CTX_PENDING].flags)
+ else
{
- unsigned int flags = ctx->regs[CTX_PENDING].flags & ~ctx->regs[CTX_NATIVE].flags;
- copy_context( &ctx->regs[CTX_NATIVE], &ctx->regs[CTX_PENDING], flags );
- ctx->regs[CTX_NATIVE].flags |= flags;
+ ctx->regs[CTX_WOW].machine = 0;
+ ctx->regs[CTX_WOW].flags = 0;
+ if (ctx->regs[CTX_PENDING].flags)
+ {
+ unsigned int flags = ctx->regs[CTX_PENDING].flags & ~ctx->regs[CTX_NATIVE].flags;
+ copy_context( &ctx->regs[CTX_NATIVE], &ctx->regs[CTX_PENDING], flags );
+ ctx->regs[CTX_NATIVE].flags |= flags;
+ }
}
ctx->regs[CTX_PENDING].flags = 0;
ctx->status = STATUS_SUCCESS;
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/123
More information about the wine-devel
mailing list