mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
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:
parent
d7398f2363
commit
587ffa4508
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=114734
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user