mirror of
https://github.com/reactos/reactos.git
synced 2025-06-01 07:28:19 +00:00
[NTOSKRNL]
- If neccessary unlock the working set in MiMakeSystemAddressValid before calling MmAccessFault, fixes a failed ASSERT, when coming from NtFreeVirtualMemory - Remove duplicated ASSERT svn path=/trunk/; revision=56300
This commit is contained in:
parent
ccc0959e61
commit
d188878e4e
2 changed files with 13 additions and 2 deletions
|
@ -917,7 +917,6 @@ MiLockProcessWorkingSet(IN PEPROCESS Process,
|
|||
//ASSERT(Process->Vm.Flags.AcquiredUnsafe == 0);
|
||||
|
||||
/* Okay, now we can own it exclusively */
|
||||
ASSERT(Thread->OwnsProcessWorkingSetExclusive == FALSE);
|
||||
Thread->OwnsProcessWorkingSetExclusive = TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,8 @@ MiMakeSystemAddressValid(IN PVOID PageTableVirtualAddress,
|
|||
IN PEPROCESS CurrentProcess)
|
||||
{
|
||||
NTSTATUS Status;
|
||||
BOOLEAN LockChange = FALSE;
|
||||
BOOLEAN WsWasLocked = FALSE, LockChange = FALSE;
|
||||
PETHREAD CurrentThread = PsGetCurrentThread();
|
||||
|
||||
/* Must be a non-pool page table, since those are double-mapped already */
|
||||
ASSERT(PageTableVirtualAddress > MM_HIGHEST_USER_ADDRESS);
|
||||
|
@ -47,6 +48,14 @@ MiMakeSystemAddressValid(IN PVOID PageTableVirtualAddress,
|
|||
/* Check if the page table is valid */
|
||||
while (!MmIsAddressValid(PageTableVirtualAddress))
|
||||
{
|
||||
/* Check if the WS is locked */
|
||||
if (CurrentThread->OwnsProcessWorkingSetExclusive)
|
||||
{
|
||||
/* Unlock the working set and remember it was locked */
|
||||
MiUnlockProcessWorkingSet(CurrentProcess, CurrentThread);
|
||||
WsWasLocked = TRUE;
|
||||
}
|
||||
|
||||
/* Fault it in */
|
||||
Status = MmAccessFault(FALSE, PageTableVirtualAddress, KernelMode, NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
|
@ -59,6 +68,9 @@ MiMakeSystemAddressValid(IN PVOID PageTableVirtualAddress,
|
|||
(ULONG_PTR)PageTableVirtualAddress);
|
||||
}
|
||||
|
||||
/* Lock the working set again */
|
||||
if (WsWasLocked) MiLockProcessWorkingSet(CurrentProcess, CurrentThread);
|
||||
|
||||
/* This flag will be useful later when we do better locking */
|
||||
LockChange = TRUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue