X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/fdb8e4aac282b72d4670aa3a26d9bba07afc7e6f..1c15e88899094343f75aeba04122cd96a96b428e:/usr/src/sys/kern/sys_process.c diff --git a/usr/src/sys/kern/sys_process.c b/usr/src/sys/kern/sys_process.c index 3aa6303f40..d8989d7f8b 100644 --- a/usr/src/sys/kern/sys_process.c +++ b/usr/src/sys/kern/sys_process.c @@ -3,7 +3,7 @@ * All rights reserved. The Berkeley software License Agreement * specifies the terms and conditions for redistribution. * - * @(#)sys_process.c 7.14 (Berkeley) %G% + * @(#)sys_process.c 7.12 (Berkeley) 6/28/90 */ #define IPCREG @@ -11,14 +11,14 @@ #include "user.h" #include "proc.h" #include "vnode.h" +#include "text.h" #include "seg.h" #include "buf.h" #include "ptrace.h" #include "machine/reg.h" #include "machine/psl.h" -#include "../vm/vm_page.h" -#include "../vm/vm_prot.h" +#include "machine/pte.h" /* * Priority for tracing @@ -95,6 +95,9 @@ procxmt(p) register struct proc *p; { register int i, *poff; + register struct text *xp; + struct vattr vattr; + struct vnode *vp; if (ipc.ip_lock != p->p_pid) return (0); @@ -128,22 +131,37 @@ procxmt(p) break; case PT_WRITE_I: /* write the child's text space */ + /* + * If text, must assure exclusive use + */ + if (xp = p->p_textp) { + vp = xp->x_vptr; + VOP_GETATTR(vp, &vattr, u.u_cred); + if (xp->x_count!=1 || (vattr.va_mode & VSVTX)) + goto error; + xp->x_flag |= XTRC; + } + i = -1; if ((i = suiword((caddr_t)ipc.ip_addr, ipc.ip_data)) < 0) { - vm_offset_t sa, ea; - int rv; - - sa = trunc_page((vm_offset_t)ipc.ip_addr); - ea = round_page((vm_offset_t)ipc.ip_addr+sizeof(int)-1); - rv = vm_map_protect(p->p_map, sa, ea, - VM_PROT_DEFAULT, FALSE); - if (rv == KERN_SUCCESS) { + if (!chgprot((caddr_t)ipc.ip_addr, RW) && + !chgprot((caddr_t)ipc.ip_addr+(sizeof(int)-1), RW)) i = suiword((caddr_t)ipc.ip_addr, ipc.ip_data); - (void) vm_map_protect(p->p_map, sa, ea, - VM_PROT_READ|VM_PROT_EXECUTE, FALSE); - } + (void) chgprot((caddr_t)ipc.ip_addr, RO); + (void) chgprot((caddr_t)ipc.ip_addr+(sizeof(int)-1), RO); } if (i < 0) goto error; +#if defined(tahoe) + /* make sure the old value is not in cache */ + ckeyrelease(p->p_ckey); + p->p_ckey = getcodekey(); +#endif + if (xp) { + xp->x_flag |= XWRIT; +#if defined(tahoe) + xp->x_ckey = p->p_ckey; +#endif + } break; case PT_WRITE_D: /* write the child's data space */ @@ -199,7 +217,7 @@ procxmt(p) case PT_KILL: /* kill the child process */ wakeup((caddr_t)&ipc); - exit(p, (int)p->p_xstat); + exit(p, p->p_xstat); default: error: