The sparc64 pmap at least requires the fault access_type to be a
authorguenther <guenther@openbsd.org>
Thu, 3 Feb 2022 19:57:11 +0000 (19:57 +0000)
committerguenther <guenther@openbsd.org>
Thu, 3 Feb 2022 19:57:11 +0000 (19:57 +0000)
subset of the request permissions, so when forcing an initial RO
fault for CoW also clamp the access_type.

problem reported by bluhm@
based on a suggestion from miod@
ok kettenis@

sys/uvm/uvm_fault.c

index 312ba2b..e7a54be 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: uvm_fault.c,v 1.125 2022/02/01 08:38:53 guenther Exp $        */
+/*     $OpenBSD: uvm_fault.c,v 1.126 2022/02/03 19:57:11 guenther Exp $        */
 /*     $NetBSD: uvm_fault.c,v 1.51 2000/08/06 00:22:53 thorpej Exp $   */
 
 /*
@@ -1022,8 +1022,10 @@ uvm_fault_upper(struct uvm_faultinfo *ufi, struct uvm_faultctx *flt,
                 * uvm does it by inserting the new mapping RO and
                 * letting it fault again.
                 */
-               if (P_HASSIBLING(curproc))
+               if (P_HASSIBLING(curproc)) {
                        flt->enter_prot &= ~PROT_WRITE;
+                       flt->access_type &= ~PROT_WRITE;
+               }
 #endif
 
                /*