From 17b8a8a77aad24178e63b0ea931048a1ca22a381 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 25 Apr 2003 20:02:16 +0000 Subject: Push down Giant around calls to proc_rwmem() in kern_ptrace. kern_ptrace() should now be MP safe. --- sys/kern/sys_process.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'sys/kern/sys_process.c') 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); -- cgit v1.3