mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[NTOS:MM] Make MI_MAKE_HARDWARE_PTE_KERNEL actually respect the protection it is given
This one would set a page as writable & dirty even if MM_READONLY was passed CORE-17587
This commit is contained in:
parent
46c84779b6
commit
4ddc66f224
1 changed files with 20 additions and 2 deletions
|
@ -790,12 +790,23 @@ MI_MAKE_HARDWARE_PTE_KERNEL(IN PMMPTE NewPte,
|
|||
ASSERT(!MI_IS_SESSION_PTE(MappingPte));
|
||||
ASSERT((MappingPte < (PMMPTE)PDE_BASE) || (MappingPte > (PMMPTE)PDE_TOP));
|
||||
|
||||
/* Check that we are not setting valid a page that should not be */
|
||||
ASSERT(ProtectionMask & MM_PROTECT_ACCESS);
|
||||
ASSERT((ProtectionMask & MM_GUARDPAGE) == 0);
|
||||
|
||||
/* Start fresh */
|
||||
*NewPte = ValidKernelPte;
|
||||
NewPte->u.Long = 0;
|
||||
|
||||
/* Set the protection and page */
|
||||
NewPte->u.Hard.PageFrameNumber = PageFrameNumber;
|
||||
NewPte->u.Long |= MmProtectToPteMask[ProtectionMask];
|
||||
|
||||
/* Make this valid & global */
|
||||
#ifdef _GLOBAL_PAGES_ARE_AWESOME_
|
||||
if (KeFeatureBits & KF_GLOBAL_PAGE)
|
||||
NewPte->u.Hard.Global = 1;
|
||||
#endif
|
||||
NewPte->u.Hard.Valid = 1;
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -808,6 +819,10 @@ MI_MAKE_HARDWARE_PTE(IN PMMPTE NewPte,
|
|||
IN ULONG_PTR ProtectionMask,
|
||||
IN PFN_NUMBER PageFrameNumber)
|
||||
{
|
||||
/* Check that we are not setting valid a page that should not be */
|
||||
ASSERT(ProtectionMask & MM_PROTECT_ACCESS);
|
||||
ASSERT((ProtectionMask & MM_GUARDPAGE) == 0);
|
||||
|
||||
/* Set the protection and page */
|
||||
NewPte->u.Long = MiDetermineUserGlobalPteMask(MappingPte);
|
||||
NewPte->u.Long |= MmProtectToPteMask[ProtectionMask];
|
||||
|
@ -830,7 +845,10 @@ MI_MAKE_HARDWARE_PTE_USER(IN PMMPTE NewPte,
|
|||
/* Start fresh */
|
||||
NewPte->u.Long = 0;
|
||||
|
||||
/* Set the protection and page */
|
||||
/* Check that we are not setting valid a page that should not be */
|
||||
ASSERT(ProtectionMask & MM_PROTECT_ACCESS);
|
||||
ASSERT((ProtectionMask & MM_GUARDPAGE) == 0);
|
||||
|
||||
NewPte->u.Hard.Valid = TRUE;
|
||||
NewPte->u.Hard.Owner = TRUE;
|
||||
NewPte->u.Hard.PageFrameNumber = PageFrameNumber;
|
||||
|
|
Loading…
Reference in a new issue