From: deraadt Date: Tue, 4 Feb 1997 17:23:20 +0000 (+0000) Subject: do not accidentally pass VM_PROT_WRITE|VM_PROT_READ X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=dd8cf09e9c6acd0e4691495a0ce8739756a6b450;p=openbsd do not accidentally pass VM_PROT_WRITE|VM_PROT_READ --- diff --git a/sys/arch/mvme68k/mvme68k/trap.c b/sys/arch/mvme68k/mvme68k/trap.c index 07ba8798f4d..fa1dfbc9d99 100644 --- a/sys/arch/mvme68k/mvme68k/trap.c +++ b/sys/arch/mvme68k/mvme68k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.12 1997/02/04 12:29:20 deraadt Exp $ */ +/* $OpenBSD: trap.c,v 1.13 1997/02/04 17:23:20 deraadt Exp $ */ /* * Copyright (c) 1995 Theo de Raadt @@ -549,7 +549,7 @@ copyfault: register struct vmspace *vm = NULL; register vm_map_t map; int rv; - vm_prot_t ftype; + vm_prot_t ftype, vftype; extern vm_map_t kernel_map; /* vmspace only significant if T_USER */ @@ -574,9 +574,10 @@ copyfault: map = kernel_map; else map = &vm->vm_map; - if (WRFAULT(code)) + if (WRFAULT(code)) { + vftype = VM_PROT_WRITE; ftype = VM_PROT_READ | VM_PROT_WRITE; - else + } else ftype = VM_PROT_READ; va = trunc_page((vm_offset_t)v); @@ -640,7 +641,7 @@ copyfault: goto dopanic; } frame.f_pad = code & 0xffff; - ucode = ftype; + ucode = vftype; typ = SEGV_MAPERR; i = SIGSEGV; break; diff --git a/sys/arch/sparc/sparc/trap.c b/sys/arch/sparc/sparc/trap.c index 65569121f50..d3ebb6efb61 100644 --- a/sys/arch/sparc/sparc/trap.c +++ b/sys/arch/sparc/sparc/trap.c @@ -776,7 +776,7 @@ mem_access_fault4m(type, sfsr, sfva, afsr, afva, tf) register struct vmspace *vm; register vm_offset_t va; register int rv; - vm_prot_t ftype; + vm_prot_t ftype, vftype; int onfault; u_quad_t sticks; #if DEBUG @@ -928,6 +928,7 @@ static int lastdouble; /* Now munch on protections... */ ftype = sfsr & SFSR_AT_STORE ? VM_PROT_READ|VM_PROT_WRITE:VM_PROT_READ; + vftype = sfsr & SFSR_AT_STORE ? VM_PROT_WRITE:VM_PROT_READ; if (psr & PSR_PS) { extern char Lfsbail[]; if (sfsr & SFSR_AT_TEXT || type == T_TEXTFAULT) { @@ -1016,7 +1017,7 @@ kfault: tf->tf_npc = onfault + 4; return; } - trapsignal(p, SIGSEGV, ftype, SEGV_MAPERR, (caddr_t)sfva); + trapsignal(p, SIGSEGV, vftype, SEGV_MAPERR, (caddr_t)sfva); } out: if ((psr & PSR_PS) == 0) {