mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-11-21 16:46:54 -08:00
ntdll-x86_64_Builtin_Frames: Remove patch.
There is no record at all of what this was for. However, it's not hard to make a good guess. The effect of the patch is to skip walking the TEB chain if the faulting %esp is *above* the first element in the TEB chain. The most obvious thing this protects against is the case where the application switched stacks and the new stack happened to be at a higher address. Without this patch, we would walk through the whole TEB chain, since all of its entries would be below the target frame we are unwinding to. But they wouldn't actually be "inner to" it, and so we'd incorrectly hit Wine try/catch blocks. The most notable such try/catch block is the unhandled exception filter itself, and it would necessarily have been triggered by any such exception if no other blocks were. One can further speculate that this patch, like many others in Wine-Staging, was written for Cygwin, which is known to switch stacks. Besides Wine commits c22aa54e9977785eafcd7cc3811116e5f4dd2da8, and other more targeted workarounds to specific functions, the workaround introduced by this patch was obviated by a similar, but more complete and holistic, workaround upstream, namely 8fe95d29d32533e8fa28383c0211555eb71ea6c1. Thus this patch has been, in almost the simplest sense, upstreamed. Remove it.
This commit is contained in:
parent
b0736d0417
commit
53e890acb9
@ -1,64 +0,0 @@
|
||||
From 5e65a77ff8c907d5560164c30a24d1bf171b3b8f Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Tue, 12 Apr 2016 19:03:57 +0200
|
||||
Subject: ntdll: Improve handling of builtin frames for x86_64 when switching
|
||||
stacks.
|
||||
|
||||
---
|
||||
dlls/ntdll/signal_x86_64.c | 24 +++++++++++++++---------
|
||||
1 file changed, 15 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
|
||||
index b56c1ea..93475d54 100644
|
||||
--- a/dlls/ntdll/signal_x86_64.c
|
||||
+++ b/dlls/ntdll/signal_x86_64.c
|
||||
@@ -2420,16 +2420,20 @@ static NTSTATUS call_stack_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_contex
|
||||
if (status != STATUS_UNHANDLED_EXCEPTION) return status;
|
||||
}
|
||||
/* hack: call wine handlers registered in the tib list */
|
||||
- else while ((ULONG64)teb_frame < new_context.Rsp)
|
||||
+ else if ((ULONG64)teb_frame >= context.Rsp)
|
||||
{
|
||||
- TRACE( "found wine frame %p rsp %lx handler %p\n",
|
||||
- teb_frame, new_context.Rsp, teb_frame->Handler );
|
||||
- dispatch.EstablisherFrame = (ULONG64)teb_frame;
|
||||
- context = *orig_context;
|
||||
- status = call_teb_handler( rec, &dispatch, teb_frame, orig_context );
|
||||
- if (status != STATUS_UNHANDLED_EXCEPTION) return status;
|
||||
- teb_frame = teb_frame->Prev;
|
||||
+ while ((ULONG64)teb_frame < new_context.Rsp)
|
||||
+ {
|
||||
+ TRACE( "found wine frame %p rsp %lx handler %p\n",
|
||||
+ teb_frame, new_context.Rsp, teb_frame->Handler );
|
||||
+ dispatch.EstablisherFrame = (ULONG64)teb_frame;
|
||||
+ context = *orig_context;
|
||||
+ status = call_teb_handler( rec, &dispatch, teb_frame, orig_context );
|
||||
+ if (status != STATUS_UNHANDLED_EXCEPTION) return status;
|
||||
+ teb_frame = teb_frame->Prev;
|
||||
+ }
|
||||
}
|
||||
+ else WARN( "skipping wine frame %p (on other stack?)\n", teb_frame );
|
||||
|
||||
if (new_context.Rsp == (ULONG64)NtCurrentTeb()->Tib.StackBase) break;
|
||||
context = new_context;
|
||||
@@ -3592,7 +3596,8 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
|
||||
if (dispatch.EstablisherFrame == (ULONG64)end_frame) rec->ExceptionFlags |= EH_TARGET_UNWIND;
|
||||
call_unwind_handler( rec, &dispatch );
|
||||
}
|
||||
- else /* hack: call builtin handlers registered in the tib list */
|
||||
+ /* hack: call builtin handlers registered in the tib list */
|
||||
+ else if ((ULONG64)teb_frame >= context->Rsp)
|
||||
{
|
||||
DWORD64 backup_frame = dispatch.EstablisherFrame;
|
||||
while ((ULONG64)teb_frame < new_context.Rsp && (ULONG64)teb_frame < (ULONG64)end_frame)
|
||||
@@ -3605,6 +3610,7 @@ void WINAPI RtlUnwindEx( PVOID end_frame, PVOID target_ip, EXCEPTION_RECORD *rec
|
||||
if ((ULONG64)teb_frame == (ULONG64)end_frame && (ULONG64)end_frame < new_context.Rsp) break;
|
||||
dispatch.EstablisherFrame = backup_frame;
|
||||
}
|
||||
+ else WARN( "skipping wine frame %p (on other stack?)\n", teb_frame );
|
||||
|
||||
if (dispatch.EstablisherFrame == (ULONG64)end_frame) break;
|
||||
*context = new_context;
|
||||
--
|
||||
2.7.1
|
||||
|
@ -1,2 +0,0 @@
|
||||
Fixes: Improve handling of builtin frames for x86_64 when switching stacks
|
||||
Disabled: true
|
Loading…
Reference in New Issue
Block a user