summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/sys_process.c35
-rw-r--r--sys/sys/ptrace.h4
2 files changed, 17 insertions, 22 deletions
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
index bdecbf3..51bbdcd 100644
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -336,6 +336,7 @@ ptrace(struct thread *td, struct ptrace_args *uap)
break;
default:
addr = uap->addr;
+ break;
}
if (error)
return (error);
@@ -449,21 +450,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
/* OK */
break;
- case PT_READ_I:
- case PT_READ_D:
- case PT_WRITE_I:
- case PT_WRITE_D:
- case PT_IO:
- case PT_CONTINUE:
- case PT_KILL:
- case PT_STEP:
- case PT_DETACH:
- case PT_GETREGS:
- case PT_SETREGS:
- case PT_GETFPREGS:
- case PT_SETFPREGS:
- case PT_GETDBREGS:
- case PT_SETDBREGS:
+ default:
/* not being traced... */
if ((p->p_flag & P_TRACED) == 0) {
error = EPERM;
@@ -484,10 +471,6 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
/* OK */
break;
-
- default:
- error = EINVAL;
- goto fail;
}
td2 = FIRST_THREAD_IN_PROC(p);
@@ -702,12 +685,20 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
return (error);
default:
- KASSERT(0, ("unreachable code\n"));
+#ifdef __HAVE_PTRACE_MACHDEP
+ if (req >= PT_FIRSTMACH) {
+ _PHOLD(p);
+ error = cpu_ptrace(td2, req, addr, data);
+ _PRELE(p);
+ PROC_UNLOCK(p);
+ return (error);
+ }
+#endif
break;
}
- KASSERT(0, ("unreachable code\n"));
- return (0);
+ /* Unknown request. */
+ error = EINVAL;
fail:
PROC_UNLOCK(p);
diff --git a/sys/sys/ptrace.h b/sys/sys/ptrace.h
index 09d8742..ef7262a 100644
--- a/sys/sys/ptrace.h
+++ b/sys/sys/ptrace.h
@@ -81,6 +81,10 @@ struct ptrace_io_desc {
int ptrace_set_pc(struct thread *_td, unsigned long _addr);
int ptrace_single_step(struct thread *_td);
+#ifdef __HAVE_PTRACE_MACHDEP
+int cpu_ptrace(struct thread *_td, int _req, void *_addr, int _data);
+#endif
+
/*
* These are prototypes for functions that implement some of the
* debugging functionality exported by procfs / linprocfs and by the
OpenPOWER on IntegriCloud