aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/alpha/alpha/machdep.c56
-rw-r--r--sys/alpha/include/ptrace.h6
-rw-r--r--sys/amd64/amd64/machdep.c54
-rw-r--r--sys/amd64/include/ptrace.h5
-rw-r--r--sys/i386/i386/machdep.c54
-rw-r--r--sys/i386/include/ptrace.h5
-rw-r--r--sys/ia64/ia64/machdep.c53
-rw-r--r--sys/ia64/include/ptrace.h5
-rw-r--r--sys/kern/sys_process.c43
-rw-r--r--sys/pc98/i386/machdep.c54
-rw-r--r--sys/pc98/pc98/machdep.c54
-rw-r--r--sys/powerpc/aim/machdep.c16
-rw-r--r--sys/powerpc/include/ptrace.h5
-rw-r--r--sys/powerpc/powerpc/machdep.c16
-rw-r--r--sys/sparc64/include/ptrace.h2
-rw-r--r--sys/sparc64/sparc64/machdep.c14
-rw-r--r--sys/sys/ptrace.h4
17 files changed, 2 insertions, 444 deletions
diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c
index f1c21bb58712..490ea29c838c 100644
--- a/sys/alpha/alpha/machdep.c
+++ b/sys/alpha/alpha/machdep.c
@@ -1851,62 +1851,6 @@ ptrace_single_step(struct proc *p)
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)
{
diff --git a/sys/alpha/include/ptrace.h b/sys/alpha/include/ptrace.h
index 2af0ec498c9e..3dca2aa6debf 100644
--- a/sys/alpha/include/ptrace.h
+++ b/sys/alpha/include/ptrace.h
@@ -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
-
diff --git a/sys/amd64/amd64/machdep.c b/sys/amd64/amd64/machdep.c
index a7f53eb3804c..41d0411d442a 100644
--- a/sys/amd64/amd64/machdep.c
+++ b/sys/amd64/amd64/machdep.c
@@ -2054,60 +2054,6 @@ ptrace_single_step(p)
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;
diff --git a/sys/amd64/include/ptrace.h b/sys/amd64/include/ptrace.h
index d59a38f3409b..ea3477e11d81 100644
--- a/sys/amd64/include/ptrace.h
+++ b/sys/amd64/include/ptrace.h
@@ -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
-
diff --git a/sys/i386/i386/machdep.c b/sys/i386/i386/machdep.c
index a7f53eb3804c..41d0411d442a 100644
--- a/sys/i386/i386/machdep.c
+++ b/sys/i386/i386/machdep.c
@@ -2054,60 +2054,6 @@ ptrace_single_step(p)
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;
diff --git a/sys/i386/include/ptrace.h b/sys/i386/include/ptrace.h
index d59a38f3409b..ea3477e11d81 100644
--- a/sys/i386/include/ptrace.h
+++ b/sys/i386/include/ptrace.h
@@ -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
-
diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c
index 1bf4a78cb116..f91578232c03 100644
--- a/sys/ia64/ia64/machdep.c
+++ b/sys/ia64/ia64/machdep.c
@@ -1084,59 +1084,6 @@ ptrace_single_step(struct proc *p)
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)
{
diff --git a/sys/ia64/include/ptrace.h b/sys/ia64/include/ptrace.h
index 8a7ff84fd594..2cf8f264b660 100644
--- a/sys/ia64/include/ptrace.h
+++ b/sys/ia64/include/ptrace.h
@@ -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
-
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
index 66d7e675b33a..a81a768011c7 100644
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -256,10 +256,8 @@ ptrace(curp, uap)
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:
@@ -448,47 +446,6 @@ ptrace(curp, uap)
}
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;
goto sendsig; /* in PT_CONTINUE above */
diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c
index 86b6db25fd58..48eef4944f1c 100644
--- a/sys/pc98/i386/machdep.c
+++ b/sys/pc98/i386/machdep.c
@@ -2118,60 +2118,6 @@ ptrace_single_step(p)
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;
diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c
index 86b6db25fd58..48eef4944f1c 100644
--- a/sys/pc98/pc98/machdep.c
+++ b/sys/pc98/pc98/machdep.c
@@ -2118,60 +2118,6 @@ ptrace_single_step(p)
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;
diff --git a/sys/powerpc/aim/machdep.c b/sys/powerpc/aim/machdep.c
index 3427d8380b2f..586210b9466f 100644
--- a/sys/powerpc/aim/machdep.c
+++ b/sys/powerpc/aim/machdep.c
@@ -964,22 +964,6 @@ ptrace_single_step(struct proc *p)
}
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)
{
diff --git a/sys/powerpc/include/ptrace.h b/sys/powerpc/include/ptrace.h
index d59a38f3409b..ea3477e11d81 100644
--- a/sys/powerpc/include/ptrace.h
+++ b/sys/powerpc/include/ptrace.h
@@ -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
-
diff --git a/sys/powerpc/powerpc/machdep.c b/sys/powerpc/powerpc/machdep.c
index 3427d8380b2f..586210b9466f 100644
--- a/sys/powerpc/powerpc/machdep.c
+++ b/sys/powerpc/powerpc/machdep.c
@@ -964,22 +964,6 @@ ptrace_single_step(struct proc *p)
}
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)
{
diff --git a/sys/sparc64/include/ptrace.h b/sys/sparc64/include/ptrace.h
index 8dde79ecf358..d5913a517b02 100644
--- a/sys/sparc64/include/ptrace.h
+++ b/sys/sparc64/include/ptrace.h
@@ -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_ */
diff --git a/sys/sparc64/sparc64/machdep.c b/sys/sparc64/sparc64/machdep.c
index faacd0de5cdd..361f21d94c0c 100644
--- a/sys/sparc64/sparc64/machdep.c
+++ b/sys/sparc64/sparc64/machdep.c
@@ -365,20 +365,6 @@ cpu_halt(void)
}
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;
diff --git a/sys/sys/ptrace.h b/sys/sys/ptrace.h
index dcbafc242048..71f6013d49a7 100644
--- a/sys/sys/ptrace.h
+++ b/sys/sys/ptrace.h
@@ -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 */