Commit 1b310a5a authored by Tim Clem's avatar Tim Clem Committed by Alexandre Julliard

ntdll: Treat read faults on readable pages as write faults on macOS.

Working around a Rosetta bug on Apple Silicon - faults for certain instructions (e.g. lock cmpxchg8b) are misreported, which can break VPROT_WRITEWATCH handling.
parent 9d255d6d
......@@ -3692,6 +3692,16 @@ NTSTATUS virtual_handle_fault( void *addr, DWORD err, void *stack )
mutex_lock( &virtual_mutex ); /* no need for signal masking inside signal handler */
vprot = get_page_vprot( page );
#ifdef __APPLE__
/* Rosetta on Apple Silicon misreports certain write faults as read faults. */
if (err == EXCEPTION_READ_FAULT && (get_unix_prot( vprot ) & PROT_READ))
{
WARN( "treating read fault in a readable page as a write fault, addr %p\n", addr );
err = EXCEPTION_WRITE_FAULT;
}
#endif
if (!is_inside_signal_stack( stack ) && (vprot & VPROT_GUARD))
{
struct thread_stack_info stack_info;
......
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