[PATCH] ntdll: Clear CONTEXT_XSTATE flag in RtlUnwindEx().
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49749 Signed-off-by: Paul Gofman <pgofman(a)codeweavers.com> --- The unwind handler which is called from Windows clr.dll which after processing ACCESS_VIOLATION exception sets the CONTEXT_XSTATE flag in unwind context (probably just copis the original exception context at some moment which has this flag since 16ed88a95234d844fee9fc19053c5c7f618f92ba). Meanwhile the CONTEXT_EX structure is garbage. The consequet NtSetContextThread() is crashing trying to restore xstate from invalid location. dlls/ntdll/signal_x86_64.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c index ba91cc13dfe..6fbb612825b 100644 --- a/dlls/ntdll/signal_x86_64.c +++ b/dlls/ntdll/signal_x86_64.c @@ -1244,7 +1244,9 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec { ULONG64 frame; - *context = new_context = *dispatch.ContextRecord; + new_context = *dispatch.ContextRecord; + new_context.ContextFlags &= ~0x40; + *context = new_context; dispatch.ContextRecord = context; RtlVirtualUnwind( UNW_FLAG_NHANDLER, dispatch.ImageBase, dispatch.ControlPc, dispatch.FunctionEntry, @@ -1267,7 +1269,9 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec teb_frame = __wine_pop_frame( teb_frame ); - *context = new_context = *dispatch.ContextRecord; + new_context = *dispatch.ContextRecord; + new_context.ContextFlags &= ~0x40; + *context = new_context; dispatch.ContextRecord = context; RtlVirtualUnwind( UNW_FLAG_NHANDLER, dispatch.ImageBase, dispatch.ControlPc, dispatch.FunctionEntry, -- 2.26.2
Hi, While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=77808 Your paranoid android. === debiant (32 bit Chinese:China report) === ntdll: threadpool.c:1904: Test failed: WaitForSingleObject returned 258
participants (2)
-
Marvin -
Paul Gofman