diff options
author | 2019-01-02 23:08:35 +0000 | |
---|---|---|
committer | 2019-01-02 23:08:35 +0000 | |
commit | 09fb95271b8bea02fcef98c75efe342c5d0fd52c (patch) | |
tree | 35c85b317f17248e4e4eaa8817c19c92ceb5207d | |
parent | Error out on missing table command, zap internal wrapper function (diff) | |
download | wireguard-openbsd-09fb95271b8bea02fcef98c75efe342c5d0fd52c.tar.xz wireguard-openbsd-09fb95271b8bea02fcef98c75efe342c5d0fd52c.zip |
In pmap_page_protect(), zap the PTE before unlinking. At that point the
PTED_VA_MANAGED_M flag is still set so proper MOD/REF accounting will
happen. Fixes memory corruption that would invariably happen when a
machine started swapping.
Giant cluestick from George Koehler.
ok visa@, mpi@
-rw-r--r-- | sys/arch/powerpc/powerpc/pmap.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/arch/powerpc/powerpc/pmap.c b/sys/arch/powerpc/powerpc/pmap.c index e85e69785ca..289da0ca3e7 100644 --- a/sys/arch/powerpc/powerpc/pmap.c +++ b/sys/arch/powerpc/powerpc/pmap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pmap.c,v 1.168 2018/10/22 17:31:25 krw Exp $ */ +/* $OpenBSD: pmap.c,v 1.169 2019/01/02 23:08:35 kettenis Exp $ */ /* * Copyright (c) 2015 Martin Pieuchot @@ -2067,7 +2067,9 @@ void pmap_page_protect(struct vm_page *pg, vm_prot_t prot) { struct pte_desc *pted; + void *pte; pmap_t pm; + int s; if (prot == PROT_NONE) { mtx_enter(&pg->mdpage.pv_mtx); @@ -2098,6 +2100,11 @@ pmap_page_protect(struct vm_page *pg, vm_prot_t prot) continue; } + PMAP_HASH_LOCK(s); + if ((pte = pmap_ptedinhash(pted)) != NULL) + pte_zap(pte, pted); + PMAP_HASH_UNLOCK(s); + pted->pted_va &= ~PTED_VA_MANAGED_M; LIST_REMOVE(pted, pted_pv_list); mtx_leave(&pg->mdpage.pv_mtx); |