summaryrefslogtreecommitdiff
path: root/sys/kern/sys_process.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2004-03-15 18:48:28 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2004-03-15 18:48:28 +0000
commit8ac61436e6793deeba249d8e2b8332d60c83470f (patch)
tree8eba7733b3a1f60380c2220587bc77c938f2c537 /sys/kern/sys_process.c
parentd2b1b4f3c57dde2d2206df5b799a7409237ed91d (diff)
Notes
Diffstat (limited to 'sys/kern/sys_process.c')
-rw-r--r--sys/kern/sys_process.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
index 7a0c02ea01eb..636d10bdba06 100644
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -522,11 +522,13 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
switch (req) {
case PT_STEP:
+ PROC_UNLOCK(p);
error = ptrace_single_step(td2);
if (error) {
- _PRELE(p);
- goto fail;
+ PRELE(p);
+ goto fail_noproc;
}
+ PROC_LOCK(p);
break;
case PT_TO_SCE:
p->p_stops |= S_PT_SCE;
@@ -540,11 +542,13 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
}
if (addr != (void *)1) {
+ PROC_UNLOCK(p);
error = ptrace_set_pc(td2, (u_long)(uintfptr_t)addr);
if (error) {
- _PRELE(p);
- goto fail;
+ PRELE(p);
+ goto fail_noproc;
}
+ PROC_LOCK(p);
}
_PRELE(p);
@@ -705,9 +709,9 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
#ifdef __HAVE_PTRACE_MACHDEP
if (req >= PT_FIRSTMACH) {
_PHOLD(p);
- error = cpu_ptrace(td2, req, addr, data);
- _PRELE(p);
PROC_UNLOCK(p);
+ error = cpu_ptrace(td2, req, addr, data);
+ PRELE(p);
return (error);
}
#endif
@@ -719,6 +723,7 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
fail:
PROC_UNLOCK(p);
+fail_noproc:
if (proctree_locked)
sx_xunlock(&proctree_lock);
return (error);