Clean up proc locking in procfs: make sure the proc lock is held before

entering sys_process.c debugging primitives, or we violate assertions.
Also, be more careful about releasing the process lock around calls
to uiomove() which may sleep waiting for paging machinations or
related notions.  We may want to defer the uiomove() in at least
one case, but jhb will look into that at a later date.

Reported by:	Philippe Charnier <charnier@xp11.frmug.org>
Reviewed by:	jhb
This commit is contained in:
Robert Watson 2003-05-05 15:12:51 +00:00
parent d7398f2363
commit 587ffa4508
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=114734
3 changed files with 12 additions and 5 deletions

View file

@ -87,8 +87,11 @@ procfs_doprocdbregs(PFS_FILL_ARGS)
else
/* XXXKSE: */
error = proc_read_dbregs(FIRST_THREAD_IN_PROC(p), &r);
if (error == 0)
if (error == 0) {
PROC_UNLOCK(p);
error = uiomove(kv, kl, uio);
PROC_LOCK(p);
}
if (error == 0 && uio->uio_rw == UIO_WRITE) {
if (!P_SHOULDSTOP(p)) /* XXXKSE should be P_TRACED? */
error = EBUSY;

View file

@ -81,8 +81,11 @@ procfs_doprocfpregs(PFS_FILL_ARGS)
else
/* XXXKSE: */
error = proc_read_fpregs(FIRST_THREAD_IN_PROC(p), &r);
if (error == 0)
if (error == 0) {
PROC_UNLOCK(p);
error = uiomove(kv, kl, uio);
PROC_LOCK(p);
}
if (error == 0 && uio->uio_rw == UIO_WRITE) {
if (!P_SHOULDSTOP(p))
error = EBUSY;

View file

@ -76,15 +76,16 @@ procfs_doprocregs(PFS_FILL_ARGS)
kl = uio->uio_resid;
_PHOLD(p);
PROC_UNLOCK(p);
if (kl < 0)
error = EINVAL;
else
/* XXXKSE: */
error = proc_read_regs(FIRST_THREAD_IN_PROC(p), &r);
if (error == 0)
if (error == 0) {
PROC_UNLOCK(p);
error = uiomove(kv, kl, uio);
PROC_LOCK(p);
PROC_LOCK(p);
}
if (error == 0 && uio->uio_rw == UIO_WRITE) {
if (!P_SHOULDSTOP(p))
error = EBUSY;