summaryrefslogtreecommitdiffstats
path: root/sys/amd64
diff options
context:
space:
mode:
authoralc <alc@FreeBSD.org>2008-07-28 03:58:49 +0000
committeralc <alc@FreeBSD.org>2008-07-28 03:58:49 +0000
commit8c160a5c01fbc3ae9c2a5cd1623350ba7224b96e (patch)
tree6d352ba95413b44ce9700009ec587b24611eb05f /sys/amd64
parentd499ae85228790db40a63455c62071c7505a6f34 (diff)
downloadFreeBSD-src-8c160a5c01fbc3ae9c2a5cd1623350ba7224b96e.zip
FreeBSD-src-8c160a5c01fbc3ae9c2a5cd1623350ba7224b96e.tar.gz
Add a check for 1GB page mappings to pmap_change_attr() so that it fails
gracefully. (On K10 family processors the direct map is implemented using 1GB page mappings.)
Diffstat (limited to 'sys/amd64')
-rw-r--r--sys/amd64/amd64/pmap.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/amd64/amd64/pmap.c b/sys/amd64/amd64/pmap.c
index 15c5e64..c8a7502 100644
--- a/sys/amd64/amd64/pmap.c
+++ b/sys/amd64/amd64/pmap.c
@@ -4357,6 +4357,7 @@ int
pmap_change_attr(vm_offset_t va, vm_size_t size, int mode)
{
vm_offset_t base, offset, tmpva;
+ pdp_entry_t *pdpe;
pd_entry_t *pde;
pt_entry_t *pte;
@@ -4374,7 +4375,12 @@ pmap_change_attr(vm_offset_t va, vm_size_t size, int mode)
*/
PMAP_LOCK(kernel_pmap);
for (tmpva = base; tmpva < base + size; ) {
- pde = pmap_pde(kernel_pmap, tmpva);
+ pdpe = pmap_pdpe(kernel_pmap, tmpva);
+ if (*pdpe == 0 || (*pdpe & PG_PS)) {
+ PMAP_UNLOCK(kernel_pmap);
+ return (EINVAL);
+ }
+ pde = pmap_pdpe_to_pde(pdpe, tmpva);
if (*pde == 0) {
PMAP_UNLOCK(kernel_pmap);
return (EINVAL);
OpenPOWER on IntegriCloud