diff options
author | rwatson <rwatson@FreeBSD.org> | 2003-05-05 15:12:51 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2003-05-05 15:12:51 +0000 |
commit | f0516000a7c95b5ee3c5635735fd6284b20780c8 (patch) | |
tree | 9ad6dec1b793092dc34fb8685ed211b3fd0e055e | |
parent | d6a0f92ee34493f8f6ed063509b8436ce6d81cc1 (diff) | |
download | FreeBSD-src-f0516000a7c95b5ee3c5635735fd6284b20780c8.zip FreeBSD-src-f0516000a7c95b5ee3c5635735fd6284b20780c8.tar.gz |
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
-rw-r--r-- | sys/fs/procfs/procfs_dbregs.c | 5 | ||||
-rw-r--r-- | sys/fs/procfs/procfs_fpregs.c | 5 | ||||
-rw-r--r-- | sys/fs/procfs/procfs_regs.c | 7 |
3 files changed, 12 insertions, 5 deletions
diff --git a/sys/fs/procfs/procfs_dbregs.c b/sys/fs/procfs/procfs_dbregs.c index 442521c..ae6e794 100644 --- a/sys/fs/procfs/procfs_dbregs.c +++ b/sys/fs/procfs/procfs_dbregs.c @@ -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; diff --git a/sys/fs/procfs/procfs_fpregs.c b/sys/fs/procfs/procfs_fpregs.c index f1401f3..b52f5ee 100644 --- a/sys/fs/procfs/procfs_fpregs.c +++ b/sys/fs/procfs/procfs_fpregs.c @@ -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; diff --git a/sys/fs/procfs/procfs_regs.c b/sys/fs/procfs/procfs_regs.c index 6cefe7e..1bdb58b 100644 --- a/sys/fs/procfs/procfs_regs.c +++ b/sys/fs/procfs/procfs_regs.c @@ -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; |