Revert "[NTOS:MM] Allow MiMapPageInHyperSpace to be called from DISPATCH_LEVEL"

This reverts commit 8404d1a6ff.
Not ready for prime time, sorry.
This commit is contained in:
Jérôme Gardou 2021-04-07 23:26:44 +02:00
parent 8404d1a6ff
commit 82c908195c
2 changed files with 14 additions and 41 deletions

View file

@ -1011,26 +1011,17 @@ MmZeroPageThread(
); );
/* hypermap.c *****************************************************************/ /* hypermap.c *****************************************************************/
_Acquires_lock_(Process->HyperSpaceLock)
_When_(OldIrql == 0, _IRQL_requires_(DISPATCH_LEVEL))
_When_(OldIrql != 0, _IRQL_requires_(PASSIVE_LEVEL))
_When_(OldIrql != 0, _At_(*OldIrql, IRQL_saves_))
_When_(OldIrql != 0, _IRQL_raises_(DISPATCH_LEVEL))
PVOID PVOID
NTAPI NTAPI
MiMapPageInHyperSpace(_In_ PEPROCESS Process, MiMapPageInHyperSpace(IN PEPROCESS Process,
_In_ PFN_NUMBER Page, IN PFN_NUMBER Page,
_Out_opt_ PKIRQL OldIrql); IN PKIRQL OldIrql);
_Requires_lock_held_(Process->HyperSpaceLock)
_Releases_lock_(Process->HyperSpaceLock)
_IRQL_requires_(DISPATCH_LEVEL)
_When_(OldIrql != MM_NOIRQL, _At_(OldIrql, _IRQL_restores_))
VOID VOID
NTAPI NTAPI
MiUnmapPageInHyperSpace(_In_ PEPROCESS Process, MiUnmapPageInHyperSpace(IN PEPROCESS Process,
_In_ PVOID Address, IN PVOID Address,
_In_ KIRQL OldIrql); IN KIRQL OldIrql);
PVOID PVOID
NTAPI NTAPI

View file

@ -23,24 +23,16 @@ MMPTE HyperTemplatePte;
/* PRIVATE FUNCTIONS **********************************************************/ /* PRIVATE FUNCTIONS **********************************************************/
_Acquires_lock_(Process->HyperSpaceLock)
_When_(OldIrql == 0, _IRQL_requires_(DISPATCH_LEVEL))
_When_(OldIrql != 0, _IRQL_requires_(PASSIVE_LEVEL))
_When_(OldIrql != 0, _At_(*OldIrql, _IRQL_saves_))
_When_(OldIrql != 0, _IRQL_raises_(DISPATCH_LEVEL))
PVOID PVOID
NTAPI NTAPI
MiMapPageInHyperSpace(_In_ PEPROCESS Process, MiMapPageInHyperSpace(IN PEPROCESS Process,
_In_ PFN_NUMBER Page, IN PFN_NUMBER Page,
_Out_opt_ PKIRQL OldIrql) IN PKIRQL OldIrql)
{ {
MMPTE TempPte; MMPTE TempPte;
PMMPTE PointerPte; PMMPTE PointerPte;
PFN_NUMBER Offset; PFN_NUMBER Offset;
ASSERT(((OldIrql != NULL) && (KeGetCurrentIrql() == PASSIVE_LEVEL))
|| ((OldIrql == NULL) && (KeGetCurrentIrql() == DISPATCH_LEVEL)));
// //
// Never accept page 0 or non-physical pages // Never accept page 0 or non-physical pages
// //
@ -62,10 +54,7 @@ MiMapPageInHyperSpace(_In_ PEPROCESS Process,
// Acquire the hyperlock // Acquire the hyperlock
// //
ASSERT(Process == PsGetCurrentProcess()); ASSERT(Process == PsGetCurrentProcess());
if (OldIrql != NULL) KeAcquireSpinLock(&Process->HyperSpaceLock, OldIrql);
KeAcquireSpinLock(&Process->HyperSpaceLock, OldIrql);
else
KeAcquireSpinLockAtDpcLevel(&Process->HyperSpaceLock);
// //
// Now get the first free PTE // Now get the first free PTE
@ -97,15 +86,11 @@ MiMapPageInHyperSpace(_In_ PEPROCESS Process,
return MiPteToAddress(PointerPte); return MiPteToAddress(PointerPte);
} }
_Requires_lock_held_(Process->HyperSpaceLock)
_Releases_lock_(Process->HyperSpaceLock)
_IRQL_requires_(DISPATCH_LEVEL)
_When_(OldIrql != MM_NOIRQL, _At_(OldIrql, _IRQL_restores_))
VOID VOID
NTAPI NTAPI
MiUnmapPageInHyperSpace(_In_ PEPROCESS Process, MiUnmapPageInHyperSpace(IN PEPROCESS Process,
_In_ PVOID Address, IN PVOID Address,
_In_ KIRQL OldIrql) IN KIRQL OldIrql)
{ {
ASSERT(Process == PsGetCurrentProcess()); ASSERT(Process == PsGetCurrentProcess());
@ -118,10 +103,7 @@ MiUnmapPageInHyperSpace(_In_ PEPROCESS Process,
// Release the hyperlock // Release the hyperlock
// //
ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL); ASSERT(KeGetCurrentIrql() == DISPATCH_LEVEL);
if (OldIrql == MM_NOIRQL) KeReleaseSpinLock(&Process->HyperSpaceLock, OldIrql);
KeReleaseSpinLockFromDpcLevel(&Process->HyperSpaceLock);
else
KeReleaseSpinLock(&Process->HyperSpaceLock, OldIrql);
} }
PVOID PVOID