Push down Giant around calls to proc_rwmem() in kern_ptrace. kern_ptrace()

should now be MP safe.
This commit is contained in:
jhb 2003-04-25 20:02:16 +00:00
parent 57c0e7ab21
commit db5f78d397

View File

@ -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);