Be sure to have pmap_extract() return FALSE for existing, but non-valid user
authormiod <miod@openbsd.org>
Wed, 8 Jan 2014 17:12:18 +0000 (17:12 +0000)
committermiod <miod@openbsd.org>
Wed, 8 Jan 2014 17:12:18 +0000 (17:12 +0000)
pmap ptes.  Found the hard way by tobiasu@.

sys/arch/mips64/mips64/pmap.c

index fce9613..c6b4bcc 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: pmap.c,v 1.66 2012/10/03 22:46:07 miod Exp $  */
+/*     $OpenBSD: pmap.c,v 1.67 2014/01/08 17:12:18 miod Exp $  */
 
 /*
  * Copyright (c) 2001-2004 Opsycon AB  (www.opsycon.se / www.opsycon.com)
@@ -1172,7 +1172,10 @@ pmap_extract(pmap_t pmap, vaddr_t va, paddr_t *pap)
                        rv = FALSE;
                else {
                        pte += uvtopte(va);
-                       pa = pfn_to_pad(*pte) | (va & PAGE_MASK);
+                       if (*pte & PG_V)
+                               pa = pfn_to_pad(*pte) | (va & PAGE_MASK);
+                       else
+                               rv = FALSE;
                }
        }
        if (rv != FALSE)