[PATCH] ntdll: Only call wine exception handlers on the current stack.

Bernhard Übelacker bernhardu at mailbox.org
Tue Feb 1 05:54:12 CST 2022


Am 31.01.22 um 16:24 schrieb Rémi Bernon:
> MK11 creates an alternate stack and sometimes throws an exception which
> gets incorrectly handled by a Wine exception handler, causing the game
> to crash.
> 
> Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
> ---
>   dlls/ntdll/signal_x86_64.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c
> index 7e77329363c..36985832e4a 100644
> --- a/dlls/ntdll/signal_x86_64.c
> +++ b/dlls/ntdll/signal_x86_64.c
> @@ -463,7 +463,9 @@ static NTSTATUS call_stack_handlers( EXCEPTION_RECORD *rec, CONTEXT *orig_contex
>               }
>           }
>           /* hack: call wine handlers registered in the tib list */
> -        else while ((ULONG64)teb_frame < context.Rsp)
> +        else while ((ULONG64)teb_frame < context.Rsp &&
> +                    (ULONG64)teb_frame >= (ULONG64)NtCurrentTeb()->Tib.StackLimit &&
> +                    (ULONG64)teb_frame <= (ULONG64)NtCurrentTeb()->Tib.StackBase)
>           {
>               TRACE_(seh)( "found wine frame %p rsp %p handler %p\n",
>                            teb_frame, (void *)context.Rsp, teb_frame->Handler );

I am not sure but this seems kind of similar to what I think I found in
this bug: https://bugs.winehq.org/show_bug.cgi?id=52159



More information about the wine-devel mailing list