Ensure that a protection key is selected in pmap_enter_largepage().
Reviewed by: alc, kib Reported by: Coverity MFC with: r365518 Differential Revision: https://reviews.freebsd.org/D26464
This commit is contained in:
+12
-12
@@ -6537,14 +6537,14 @@ pmap_enter_largepage(pmap_t pmap, vm_offset_t va, pt_entry_t newpte, int flags,
|
||||
mp->ref_count++;
|
||||
}
|
||||
KASSERT((origpte & PG_V) == 0 || ((origpte & PG_PS) != 0 &&
|
||||
(origpte & PG_FRAME) == (newpte & PG_FRAME)),
|
||||
("va %#lx changing 1G phys page pdpe %#lx newpte %#lx",
|
||||
va, origpte, newpte));
|
||||
if ((newpte & PG_W) != 0 && (origpte & PG_W) == 0)
|
||||
(origpte & PG_FRAME) == (pten & PG_FRAME)),
|
||||
("va %#lx changing 1G phys page pdpe %#lx pten %#lx",
|
||||
va, origpte, pten));
|
||||
if ((pten & PG_W) != 0 && (origpte & PG_W) == 0)
|
||||
pmap->pm_stats.wired_count += NBPDP / PAGE_SIZE;
|
||||
else if ((newpte & PG_W) == 0 && (origpte & PG_W) != 0)
|
||||
else if ((pten & PG_W) == 0 && (origpte & PG_W) != 0)
|
||||
pmap->pm_stats.wired_count -= NBPDP / PAGE_SIZE;
|
||||
*pdpe = newpte;
|
||||
*pdpe = pten;
|
||||
} else /* (psind == 1) */ { /* 2M */
|
||||
if (!pmap_pkru_same(pmap, va, va + NBPDR))
|
||||
return (KERN_PROTECTION_FAILURE);
|
||||
@@ -6573,14 +6573,14 @@ pmap_enter_largepage(pmap_t pmap, vm_offset_t va, pt_entry_t newpte, int flags,
|
||||
mp->ref_count++;
|
||||
}
|
||||
KASSERT((origpte & PG_V) == 0 || ((origpte & PG_PS) != 0 &&
|
||||
(origpte & PG_FRAME) == (newpte & PG_FRAME)),
|
||||
("va %#lx changing 2M phys page pde %#lx newpte %#lx",
|
||||
va, origpte, newpte));
|
||||
if ((newpte & PG_W) != 0 && (origpte & PG_W) == 0)
|
||||
(origpte & PG_FRAME) == (pten & PG_FRAME)),
|
||||
("va %#lx changing 2M phys page pde %#lx pten %#lx",
|
||||
va, origpte, pten));
|
||||
if ((pten & PG_W) != 0 && (origpte & PG_W) == 0)
|
||||
pmap->pm_stats.wired_count += NBPDR / PAGE_SIZE;
|
||||
else if ((newpte & PG_W) == 0 && (origpte & PG_W) != 0)
|
||||
else if ((pten & PG_W) == 0 && (origpte & PG_W) != 0)
|
||||
pmap->pm_stats.wired_count -= NBPDR / PAGE_SIZE;
|
||||
*pde = newpte;
|
||||
*pde = pten;
|
||||
}
|
||||
if ((origpte & PG_V) == 0)
|
||||
pmap_resident_count_inc(pmap, pagesizes[psind] / PAGE_SIZE);
|
||||
|
||||
Reference in New Issue
Block a user