summaryrefslogtreecommitdiff
path: root/sys/uvm
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2023-09-02 08:24:41 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2023-09-02 08:24:41 +0000
commit210ca9859dc0f4c5c3c7a91733c91f1c50fb3cf8 (patch)
treebe59d1ce6014400cd9ecb3f293af6764616c5ce5 /sys/uvm
parentdb0b6b630192a650c1a4ee45e273c45ffba911ab (diff)
Zap anon pages mappings in uvm_anon_release() instead of in the fault handler.
This makes all code paths deactivating or freeing anons consistent. No objection from the usual suspects.
Diffstat (limited to 'sys/uvm')
-rw-r--r--sys/uvm/uvm_anon.c3
-rw-r--r--sys/uvm/uvm_fault.c3
2 files changed, 3 insertions, 3 deletions
diff --git a/sys/uvm/uvm_anon.c b/sys/uvm/uvm_anon.c
index 13d36f2789d..abb3e8de3d8 100644
--- a/sys/uvm/uvm_anon.c
+++ b/sys/uvm/uvm_anon.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_anon.c,v 1.55 2023/04/11 00:45:09 jsg Exp $ */
+/* $OpenBSD: uvm_anon.c,v 1.56 2023/09/02 08:24:40 mpi Exp $ */
/* $NetBSD: uvm_anon.c,v 1.10 2000/11/25 06:27:59 chs Exp $ */
/*
@@ -255,6 +255,7 @@ uvm_anon_release(struct vm_anon *anon)
KASSERT(anon->an_ref == 0);
uvm_lock_pageq();
+ pmap_page_protect(pg, PROT_NONE);
uvm_pagefree(pg);
uvm_unlock_pageq();
KASSERT(anon->an_page == NULL);
diff --git a/sys/uvm/uvm_fault.c b/sys/uvm/uvm_fault.c
index 4548410449a..28fa1da147c 100644
--- a/sys/uvm/uvm_fault.c
+++ b/sys/uvm/uvm_fault.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_fault.c,v 1.133 2022/11/04 09:36:44 mpi Exp $ */
+/* $OpenBSD: uvm_fault.c,v 1.134 2023/09/02 08:24:40 mpi Exp $ */
/* $NetBSD: uvm_fault.c,v 1.51 2000/08/06 00:22:53 thorpej Exp $ */
/*
@@ -396,7 +396,6 @@ uvmfault_anonget(struct uvm_faultinfo *ufi, struct vm_amap *amap,
* anon and try again.
*/
if (pg->pg_flags & PG_RELEASED) {
- pmap_page_protect(pg, PROT_NONE);
KASSERT(anon->an_ref == 0);
/*
* Released while we had unlocked amap.