[PATCH v5 resend 3/4] ntdll: Implement __fastfail().

Alexandre Julliard julliard at winehq.org
Thu Jan 20 15:21:08 CST 2022


Jinoh Kang <jinoh.kang.kr at gmail.com> writes:

> @@ -1780,8 +1804,20 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext )
>      EXCEPTION_RECORD rec = { 0 };
>      struct xcontext xcontext;
>      ucontext_t *ucontext = sigcontext;
> -    void *stack = setup_exception_record( sigcontext, &rec, &xcontext );
> +    void *stack;
>  
> +    if (TRAP_sig(ucontext) == TRAP_x86_PROTFLT && ERROR_sig(ucontext) == ((0x29 << 3) | 2))
> +    {
> +        /* __fastfail: process state is corrupted - skip setup_exception_record */
> +        rec.ExceptionCode = STATUS_STACK_BUFFER_OVERRUN;
> +        rec.ExceptionFlags = EH_NONCONTINUABLE;
> +        rec.NumberParameters = 1;
> +        rec.ExceptionInformation[0] = ECX_sig( ucontext );
> +        raise_second_chance_exception( ucontext, &rec, &xcontext );
> +        return;
> +    }

This should be part of the normal handling, not a special case at the
top. If the process state is corrupted skipping setup_exception_record()
will make things even worse. The same thing is true for other platforms.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list