Jinoh Kang jinoh.kang.kr@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.