summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpatrick <patrick@openbsd.org>2016-07-27 21:12:49 +0000
committerpatrick <patrick@openbsd.org>2016-07-27 21:12:49 +0000
commitf8fff3e0fadb113f3555bef2ae6fb548b5655450 (patch)
treee535258b5db566a386a51598787911d28d134746
parentit should not be necessary for yacc to use TMPDIR, /tmp is good enough. (diff)
downloadwireguard-openbsd-f8fff3e0fadb113f3555bef2ae6fb548b5655450.tar.xz
wireguard-openbsd-f8fff3e0fadb113f3555bef2ae6fb548b5655450.zip
When pmap_page_remove() is called by UVM, a physical page is to be
removed from pmaps it currently is in. To check if a virtual address pointing to that physical page has been mapped, the code uses the l2pte_valid() function. Unfortunately there is a difference between being valid and the PTE being zero. If a page is mapped but has never been accessed, it will be non-zero but invalid. In that case the PTE for that virtual address will not be zeroed and the virtual address will be removed from the vm page struct. The next time someone tries to map a page to that virtual address, other pmap code will consider the virtual address to be already mapped, even though that assumption is completely wrong. To make sure this does not happen, check the PTE for zero. This way the PTE will be zeroed correctly. The check for zero is how other ARM pmap code also handles this issue. ok kettenis@ tom@
-rw-r--r--sys/arch/arm/arm/pmap7.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/arch/arm/arm/pmap7.c b/sys/arch/arm/arm/pmap7.c
index 0d32bf95780..c3414325596 100644
--- a/sys/arch/arm/arm/pmap7.c
+++ b/sys/arch/arm/arm/pmap7.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap7.c,v 1.27 2016/07/19 02:26:15 tom Exp $ */
+/* $OpenBSD: pmap7.c,v 1.28 2016/07/27 21:12:49 patrick Exp $ */
/* $NetBSD: pmap.c,v 1.147 2004/01/18 13:03:50 scw Exp $ */
/*
@@ -1155,7 +1155,7 @@ pmap_page_remove(struct vm_page *pg)
KDASSERT(l2b != NULL);
ptep = &l2b->l2b_kva[l2pte_index(pv->pv_va)];
- if (l2pte_valid(*ptep)) {
+ if (*ptep != 0) {
pte = *ptep;
/* inline pmap_is_current(pm) */