Commit 9585bf67 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Remap EXCEPTION_EXECUTE_FAULT only after the internal handlers have been run.

parent 4fe014cb
......@@ -1657,6 +1657,15 @@ static void WINAPI raise_segv_exception( EXCEPTION_RECORD *rec, CONTEXT *context
if (!(rec->ExceptionCode = virtual_handle_fault( (void *)rec->ExceptionInformation[1],
rec->ExceptionInformation[0] )))
goto done;
/* send EXCEPTION_EXECUTE_FAULT only if data execution prevention is enabled */
if (rec->ExceptionInformation[0] == EXCEPTION_EXECUTE_FAULT)
{
ULONG flags;
NtQueryInformationProcess( GetCurrentProcess(), ProcessExecuteFlags,
&flags, sizeof(flags), NULL );
if (!(flags & MEM_EXECUTE_OPTION_DISABLE))
rec->ExceptionInformation[0] = EXCEPTION_READ_FAULT;
}
}
break;
case EXCEPTION_DATATYPE_MISALIGNMENT:
......@@ -1833,15 +1842,6 @@ static void segv_handler( int signal, siginfo_t *siginfo, void *sigcontext )
rec->ExceptionCode = EXCEPTION_ACCESS_VIOLATION;
rec->NumberParameters = 2;
rec->ExceptionInformation[0] = (get_error_code(context) >> 1) & 0x09;
/* Send code 8 (EXCEPTION_EXECUTE_FAULT) only if data execution
prevention is enabled */
if (rec->ExceptionInformation[0] & 8)
{
ULONG flags;
NtQueryInformationProcess( GetCurrentProcess(), ProcessExecuteFlags,
&flags, sizeof(flags), NULL );
if (!(flags & MEM_EXECUTE_OPTION_DISABLE)) rec->ExceptionInformation[0] &= 1;
}
rec->ExceptionInformation[1] = (ULONG_PTR)siginfo->si_addr;
break;
case TRAP_x86_ALIGNFLT: /* Alignment check exception */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment