summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2007-04-28 17:34:34 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2007-04-28 17:34:34 +0000
commitbdb15722c1cc668a2a74517dc494d2e45878d690 (patch)
tree3959c59f805518388db9bcd0f680203f1709b760 /sys
parentee4871152e83b3f080a803a3254075226b9ea6fe (diff)
Fix pmap_extract to not return TRUE just because we have a PTP. Make sure
that the PTP and the PTE are valid before returning success. deraadt@ ok, tested by many.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/i386/i386/pmap.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/arch/i386/i386/pmap.c b/sys/arch/i386/i386/pmap.c
index 309437a0d47..989ac7332d0 100644
--- a/sys/arch/i386/i386/pmap.c
+++ b/sys/arch/i386/i386/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.106 2007/04/26 11:31:51 art Exp $ */
+/* $OpenBSD: pmap.c,v 1.107 2007/04/28 17:34:33 art Exp $ */
/* $NetBSD: pmap.c,v 1.91 2000/06/02 17:46:37 thorpej Exp $ */
/*
@@ -1959,15 +1959,16 @@ pmap_deactivate(struct proc *p)
boolean_t
pmap_extract(struct pmap *pmap, vaddr_t va, paddr_t *pap)
{
- paddr_t retval;
- pt_entry_t *ptes;
+ pt_entry_t *ptes, pte;
- if (pmap->pm_pdir[pdei(va)]) {
+ if (pmap_valid_entry(pmap->pm_pdir[pdei(va)])) {
ptes = pmap_map_ptes(pmap);
- retval = (paddr_t)(ptes[atop(va)] & PG_FRAME);
+ pte = ptes[atop(va)];
pmap_unmap_ptes(pmap);
+ if (!pmap_valid_entry(pte))
+ return (FALSE);
if (pap != NULL)
- *pap = retval | (va & ~PG_FRAME);
+ *pap = (pte & PG_FRAME) | (va & ~PG_FRAME);
return (TRUE);
}
return (FALSE);