Index: alpha/alpha/machdep.c =================================================================== RCS file: /home/ncvs/src/sys/alpha/alpha/machdep.c,v retrieving revision 1.136 diff -u -r1.136 machdep.c --- alpha/alpha/machdep.c 2001/07/26 23:06:43 1.136 +++ alpha/alpha/machdep.c 2001/08/08 04:40:59 @@ -1851,62 +1851,6 @@ return 0; } -int ptrace_read_u_check(p, addr, len) - struct proc *p; - vm_offset_t addr; - size_t len; -{ - vm_offset_t gap; - - if ((vm_offset_t) (addr + len) < addr) - return EPERM; - if ((vm_offset_t) (addr + len) <= sizeof(struct user)) - return 0; - - gap = (char *) p->p_frame - (char *) p->p_addr; - - if ((vm_offset_t) addr < gap) - return EPERM; - if ((vm_offset_t) (addr + len) <= - (vm_offset_t) (gap + sizeof(struct trapframe))) - return 0; - return EPERM; -} - -int -ptrace_write_u(struct proc *p, vm_offset_t off, long data) -{ - vm_offset_t min; -#if 0 - struct trapframe frame_copy; - struct trapframe *tp; -#endif - - /* - * Privileged kernel state is scattered all over the user area. - * Only allow write access to parts of regs and to fpregs. - */ - min = (char *)p->p_frame - (char *)p->p_addr; - if (off >= min && off <= min + sizeof(struct trapframe) - sizeof(int)) { -#if 0 - tp = p->p_frame; - frame_copy = *tp; - *(int *)((char *)&frame_copy + (off - min)) = data; - if (!EFLAGS_SECURE(frame_copy.tf_eflags, tp->tf_eflags) || - !CS_SECURE(frame_copy.tf_cs)) - return (EINVAL); -#endif - *(int*)((char *)p->p_addr + off) = data; - return (0); - } - min = offsetof(struct user, u_pcb) + offsetof(struct pcb, pcb_fp); - if (off >= min && off <= min + sizeof(struct fpreg) - sizeof(int)) { - *(int*)((char *)p->p_addr + off) = data; - return (0); - } - return (EFAULT); -} - int alpha_pa_access(vm_offset_t pa) { Index: alpha/include/ptrace.h =================================================================== RCS file: /home/ncvs/src/sys/alpha/include/ptrace.h,v retrieving revision 1.4 diff -u -r1.4 ptrace.h --- alpha/include/ptrace.h 1999/12/29 04:27:59 1.4 +++ alpha/include/ptrace.h 2001/08/08 04:40:59 @@ -47,10 +47,4 @@ #define FIX_SSTEP(p) ptrace_clear_single_step(p) -#ifdef _KERNEL -int ptrace_clear_single_step __P((struct proc *p)); -int ptrace_read_u_check __P((struct proc *p, vm_offset_t off, size_t len)); #endif - -#endif - Index: i386/i386/machdep.c =================================================================== RCS file: /home/ncvs/src/sys/i386/i386/machdep.c,v retrieving revision 1.465 diff -u -r1.465 machdep.c --- i386/i386/machdep.c 2001/07/26 23:06:44 1.465 +++ i386/i386/machdep.c 2001/08/08 04:40:59 @@ -2054,60 +2054,6 @@ return (0); } -int ptrace_read_u_check(p, addr, len) - struct proc *p; - vm_offset_t addr; - size_t len; -{ - vm_offset_t gap; - - if ((vm_offset_t) (addr + len) < addr) - return EPERM; - if ((vm_offset_t) (addr + len) <= sizeof(struct user)) - return 0; - - gap = (char *) p->p_frame - (char *) p->p_addr; - - if ((vm_offset_t) addr < gap) - return EPERM; - if ((vm_offset_t) (addr + len) <= - (vm_offset_t) (gap + sizeof(struct trapframe))) - return 0; - return EPERM; -} - -int ptrace_write_u(p, off, data) - struct proc *p; - vm_offset_t off; - long data; -{ - struct trapframe frame_copy; - vm_offset_t min; - struct trapframe *tp; - - /* - * Privileged kernel state is scattered all over the user area. - * Only allow write access to parts of regs and to fpregs. - */ - min = (char *)p->p_frame - (char *)p->p_addr; - if (off >= min && off <= min + sizeof(struct trapframe) - sizeof(int)) { - tp = p->p_frame; - frame_copy = *tp; - *(int *)((char *)&frame_copy + (off - min)) = data; - if (!EFL_SECURE(frame_copy.tf_eflags, tp->tf_eflags) || - !CS_SECURE(frame_copy.tf_cs)) - return (EINVAL); - *(int*)((char *)p->p_addr + off) = data; - return (0); - } - min = offsetof(struct user, u_pcb) + offsetof(struct pcb, pcb_save); - if (off >= min && off <= min + sizeof(union savefpu) - sizeof(int)) { - *(int*)((char *)p->p_addr + off) = data; - return (0); - } - return (EFAULT); -} - int fill_regs(p, regs) struct proc *p; Index: i386/include/ptrace.h =================================================================== RCS file: /home/ncvs/src/sys/i386/include/ptrace.h,v retrieving revision 1.9 diff -u -r1.9 ptrace.h --- i386/include/ptrace.h 1999/12/29 04:33:06 1.9 +++ i386/include/ptrace.h 2001/08/08 04:40:59 @@ -47,9 +47,4 @@ #define PT_GETDBREGS (PT_FIRSTMACH + 5) #define PT_SETDBREGS (PT_FIRSTMACH + 6) -#ifdef _KERNEL -int ptrace_read_u_check __P((struct proc *p, vm_offset_t off, size_t len)); #endif - -#endif - Index: ia64/ia64/machdep.c =================================================================== RCS file: /home/ncvs/src/sys/ia64/ia64/machdep.c,v retrieving revision 1.38 diff -u -r1.38 machdep.c --- ia64/ia64/machdep.c 2001/08/06 12:52:17 1.38 +++ ia64/ia64/machdep.c 2001/08/08 04:40:59 @@ -1084,59 +1084,6 @@ return 0; } -int ptrace_read_u_check(struct proc *p, vm_offset_t addr, size_t len) -{ - vm_offset_t gap; - - if ((vm_offset_t) (addr + len) < addr) - return EPERM; - if ((vm_offset_t) (addr + len) <= sizeof(struct user)) - return 0; - - gap = (char *) p->p_frame - (char *) p->p_addr; - - if ((vm_offset_t) addr < gap) - return EPERM; - if ((vm_offset_t) (addr + len) <= - (vm_offset_t) (gap + sizeof(struct trapframe))) - return 0; - return EPERM; -} - -int -ptrace_write_u(struct proc *p, vm_offset_t off, long data) -{ - vm_offset_t min; -#if 0 - struct trapframe frame_copy; - struct trapframe *tp; -#endif - - /* - * Privileged kernel state is scattered all over the user area. - * Only allow write access to parts of regs and to fpregs. - */ - min = (char *)p->p_frame - (char *)p->p_addr; - if (off >= min && off <= min + sizeof(struct trapframe) - sizeof(int)) { -#if 0 - tp = p->p_frame; - frame_copy = *tp; - *(int *)((char *)&frame_copy + (off - min)) = data; - if (!EFLAGS_SECURE(frame_copy.tf_eflags, tp->tf_eflags) || - !CS_SECURE(frame_copy.tf_cs)) - return (EINVAL); -#endif - *(int*)((char *)p->p_addr + off) = data; - return (0); - } - min = offsetof(struct user, u_pcb); - if (off >= min && off <= min + sizeof(struct pcb)) { - *(int*)((char *)p->p_addr + off) = data; - return (0); - } - return (EFAULT); -} - int ia64_pa_access(vm_offset_t pa) { Index: ia64/include/ptrace.h =================================================================== RCS file: /home/ncvs/src/sys/ia64/include/ptrace.h,v retrieving revision 1.1 diff -u -r1.1 ptrace.h --- ia64/include/ptrace.h 2000/09/29 13:46:06 1.1 +++ ia64/include/ptrace.h 2001/08/08 04:40:59 @@ -45,9 +45,4 @@ #define PT_GETFPREGS (PT_FIRSTMACH + 3) #define PT_SETFPREGS (PT_FIRSTMACH + 4) -#ifdef _KERNEL -int ptrace_read_u_check __P((struct proc *p, vm_offset_t off, size_t len)); #endif - -#endif - Index: kern/sys_process.c =================================================================== RCS file: /home/ncvs/src/sys/kern/sys_process.c,v retrieving revision 1.68 diff -u -r1.68 sys_process.c --- kern/sys_process.c 2001/07/05 17:10:44 1.68 +++ kern/sys_process.c 2001/08/08 04:40:59 @@ -256,10 +256,8 @@ case PT_READ_I: case PT_READ_D: - case PT_READ_U: case PT_WRITE_I: case PT_WRITE_D: - case PT_WRITE_U: case PT_CONTINUE: case PT_KILL: case PT_STEP: @@ -447,47 +445,6 @@ error = EINVAL; /* EOF */ } return (error); - - case PT_READ_U: - if ((uintptr_t)uap->addr > UPAGES * PAGE_SIZE - sizeof(int)) { - return EFAULT; - } - if ((uintptr_t)uap->addr & (sizeof(int) - 1)) { - return EFAULT; - } - if (ptrace_read_u_check(p,(vm_offset_t) uap->addr, - sizeof(int))) { - return EFAULT; - } - error = 0; - PHOLD(p); /* user had damn well better be incore! */ - mtx_lock_spin(&sched_lock); - if (p->p_sflag & PS_INMEM) { - mtx_unlock_spin(&sched_lock); - fill_kinfo_proc (p, &p->p_addr->u_kproc); - curp->p_retval[0] = *(int *) - ((uintptr_t)p->p_addr + (uintptr_t)uap->addr); - } else { - mtx_unlock_spin(&sched_lock); - curp->p_retval[0] = 0; - error = EFAULT; - } - PRELE(p); - return error; - - case PT_WRITE_U: - PHOLD(p); /* user had damn well better be incore! */ - mtx_lock_spin(&sched_lock); - if (p->p_sflag & PS_INMEM) { - mtx_unlock_spin(&sched_lock); - fill_kinfo_proc (p, &p->p_addr->u_kproc); - error = ptrace_write_u(p, (vm_offset_t)uap->addr, uap->data); - } else { - mtx_unlock_spin(&sched_lock); - error = EFAULT; - } - PRELE(p); - return error; case PT_KILL: uap->data = SIGKILL; Index: pc98/i386/machdep.c =================================================================== RCS file: /home/ncvs/src/sys/pc98/i386/machdep.c,v retrieving revision 1.229 diff -u -r1.229 machdep.c --- pc98/i386/machdep.c 2001/07/26 23:06:44 1.229 +++ pc98/i386/machdep.c 2001/08/08 04:40:59 @@ -2118,60 +2118,6 @@ return (0); } -int ptrace_read_u_check(p, addr, len) - struct proc *p; - vm_offset_t addr; - size_t len; -{ - vm_offset_t gap; - - if ((vm_offset_t) (addr + len) < addr) - return EPERM; - if ((vm_offset_t) (addr + len) <= sizeof(struct user)) - return 0; - - gap = (char *) p->p_frame - (char *) p->p_addr; - - if ((vm_offset_t) addr < gap) - return EPERM; - if ((vm_offset_t) (addr + len) <= - (vm_offset_t) (gap + sizeof(struct trapframe))) - return 0; - return EPERM; -} - -int ptrace_write_u(p, off, data) - struct proc *p; - vm_offset_t off; - long data; -{ - struct trapframe frame_copy; - vm_offset_t min; - struct trapframe *tp; - - /* - * Privileged kernel state is scattered all over the user area. - * Only allow write access to parts of regs and to fpregs. - */ - min = (char *)p->p_frame - (char *)p->p_addr; - if (off >= min && off <= min + sizeof(struct trapframe) - sizeof(int)) { - tp = p->p_frame; - frame_copy = *tp; - *(int *)((char *)&frame_copy + (off - min)) = data; - if (!EFL_SECURE(frame_copy.tf_eflags, tp->tf_eflags) || - !CS_SECURE(frame_copy.tf_cs)) - return (EINVAL); - *(int*)((char *)p->p_addr + off) = data; - return (0); - } - min = offsetof(struct user, u_pcb) + offsetof(struct pcb, pcb_save); - if (off >= min && off <= min + sizeof(union savefpu) - sizeof(int)) { - *(int*)((char *)p->p_addr + off) = data; - return (0); - } - return (EFAULT); -} - int fill_regs(p, regs) struct proc *p; Index: powerpc/include/ptrace.h =================================================================== RCS file: /home/ncvs/src/sys/powerpc/include/ptrace.h,v retrieving revision 1.9 diff -u -r1.9 ptrace.h --- powerpc/include/ptrace.h 1999/12/29 04:33:06 1.9 +++ powerpc/include/ptrace.h 2001/08/08 04:40:59 @@ -47,9 +47,4 @@ #define PT_GETDBREGS (PT_FIRSTMACH + 5) #define PT_SETDBREGS (PT_FIRSTMACH + 6) -#ifdef _KERNEL -int ptrace_read_u_check __P((struct proc *p, vm_offset_t off, size_t len)); #endif - -#endif - Index: powerpc/powerpc/machdep.c =================================================================== RCS file: /home/ncvs/src/sys/powerpc/powerpc/machdep.c,v retrieving revision 1.4 diff -u -r1.4 machdep.c --- powerpc/powerpc/machdep.c 2001/06/27 12:35:12 1.4 +++ powerpc/powerpc/machdep.c 2001/08/08 04:40:59 @@ -964,22 +964,6 @@ } int -ptrace_write_u(struct proc *p, vm_offset_t off, long data) -{ - - /* XXX: coming soon... */ - return (ENOSYS); -} - -int -ptrace_read_u_check(struct proc *p, vm_offset_t addr, size_t len) -{ - - /* XXX: coming soon... */ - return (ENOSYS); -} - -int ptrace_clear_single_step(struct proc *p) { Index: sparc64/include/ptrace.h =================================================================== RCS file: /home/ncvs/src/sys/sparc64/include/ptrace.h,v retrieving revision 1.2 diff -u -r1.2 ptrace.h --- sparc64/include/ptrace.h 2001/07/31 06:05:04 1.2 +++ sparc64/include/ptrace.h 2001/08/08 04:40:59 @@ -29,6 +29,4 @@ #ifndef _MACHINE_PTRACE_H_ #define _MACHINE_PTRACE_H_ -int ptrace_read_u_check(struct proc *p, vm_offset_t off, size_t len); - #endif /* !_MACHINE_PTRACE_H_ */ Index: sparc64/sparc64/machdep.c =================================================================== RCS file: /home/ncvs/src/sys/sparc64/sparc64/machdep.c,v retrieving revision 1.4 diff -u -r1.4 machdep.c --- sparc64/sparc64/machdep.c 2001/08/04 18:55:15 1.4 +++ sparc64/sparc64/machdep.c 2001/08/08 04:40:59 @@ -365,20 +365,6 @@ } int -ptrace_read_u_check(struct proc *p, vm_offset_t addr, size_t len) -{ - TODO; - return (0); -} - -int -ptrace_write_u(struct proc *p, vm_offset_t off, long data) -{ - TODO; - return (0); -} - -int ptrace_set_pc(struct proc *p, u_long addr) { TODO; Index: sys/ptrace.h =================================================================== RCS file: /home/ncvs/src/sys/sys/ptrace.h,v retrieving revision 1.11 diff -u -r1.11 ptrace.h --- sys/ptrace.h 2000/10/19 18:55:22 1.11 +++ sys/ptrace.h 2001/08/08 04:40:59 @@ -40,10 +40,10 @@ #define PT_TRACE_ME 0 /* child declares it's being traced */ #define PT_READ_I 1 /* read word in child's I space */ #define PT_READ_D 2 /* read word in child's D space */ -#define PT_READ_U 3 /* read word in child's user structure */ +/* was PT_READ_U 3 * read word in child's user structure */ #define PT_WRITE_I 4 /* write word in child's I space */ #define PT_WRITE_D 5 /* write word in child's D space */ -#define PT_WRITE_U 6 /* write word in child's user structure */ +/* was PT_WRITE_U 6 * write word in child's user structure */ #define PT_CONTINUE 7 /* continue the child */ #define PT_KILL 8 /* kill the child process */ #define PT_STEP 9 /* single step the child */