mirror of
https://github.com/reactos/reactos.git
synced 2024-11-23 19:43:31 +08:00
[NTOS:MM/x64] Temporarily release AddressCreationLock in MmCreateVirtualMappingUnsafeEx
This is a hack, because the kernel mode path can incur a recursive page fault with the AddressCreationLock acquired, which would lead to a recursive acquisition, once we do proper locking in MmAccessFault. To properly fix this the PDE must be made valid, similar to the user mode path, but that is not that simple...
This commit is contained in:
parent
d96b3cd45c
commit
e685b25e35
@ -637,6 +637,9 @@ MmCreateVirtualMappingUnsafeEx(
|
||||
PMMPTE PointerPte;
|
||||
MMPTE TempPte;
|
||||
ULONG_PTR Pte;
|
||||
#ifdef _M_AMD64
|
||||
BOOLEAN LockReleased = FALSE;
|
||||
#endif
|
||||
|
||||
DPRINT("MmCreateVirtualMappingUnsafe(%p, %p, %lu, %x)\n",
|
||||
Process, Address, flProtect, Page);
|
||||
@ -665,6 +668,15 @@ MmCreateVirtualMappingUnsafeEx(
|
||||
if (!MiSynchronizeSystemPde(MiAddressToPde(Address)))
|
||||
MiFillSystemPageDirectory(Address, PAGE_SIZE);
|
||||
#endif
|
||||
|
||||
#ifdef _M_AMD64
|
||||
/* This is a temporary hack, because we can incur a recursive page fault when accessing the PDE */
|
||||
if (PsIdleProcess->AddressCreationLock.Owner == KeGetCurrentThread())
|
||||
{
|
||||
MmUnlockAddressSpace(MmGetKernelAddressSpace());
|
||||
LockReleased = TRUE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -715,6 +727,15 @@ MmCreateVirtualMappingUnsafeEx(
|
||||
MiIncrementPageTableReferences(Address);
|
||||
MiUnlockProcessWorkingSetUnsafe(Process, PsGetCurrentThread());
|
||||
}
|
||||
#ifdef _M_AMD64
|
||||
else
|
||||
{
|
||||
if (LockReleased)
|
||||
{
|
||||
MmLockAddressSpace(MmGetKernelAddressSpace());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return(STATUS_SUCCESS);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user