aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/sys_process.c
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2003-04-25 20:02:16 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2003-04-25 20:02:16 +0000
commit17b8a8a77aad24178e63b0ea931048a1ca22a381 (patch)
tree4f943820003e917487290c0af539dfd51c7c423e /sys/kern/sys_process.c
parent25d6dc0606470be1c9d44a13f2e17fdc5909fd36 (diff)
Notes
Diffstat (limited to 'sys/kern/sys_process.c')
-rw-r--r--sys/kern/sys_process.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
index b12d8a1c8eb5d..c281cee6fe9c1 100644
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -321,6 +321,9 @@ struct ptrace_args {
};
#endif
+/*
+ * MPSAFE
+ */
int
ptrace(struct thread *td, struct ptrace_args *uap)
{
@@ -627,7 +630,9 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
uio.uio_segflg = UIO_SYSSPACE; /* i.e.: the uap */
uio.uio_rw = write ? UIO_WRITE : UIO_READ;
uio.uio_td = td;
+ mtx_lock(&Giant);
error = proc_rwmem(p, &uio);
+ mtx_unlock(&Giant);
if (uio.uio_resid != 0) {
/*
* XXX proc_rwmem() doesn't currently return ENOSPC,
@@ -668,7 +673,9 @@ kern_ptrace(struct thread *td, int req, pid_t pid, void *addr, int data)
default:
return (EINVAL);
}
+ mtx_lock(&Giant);
error = proc_rwmem(p, &uio);
+ mtx_unlock(&Giant);
piod->piod_len -= uio.uio_resid;
return (error);