mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-18 15:30:21 +00:00
Add missing proctree locking to fill_kinfo_proc consumers.
This fixes r270444. Pointy hat: mjg Reported by: many MFC after: 1 week
This commit is contained in:
parent
0375d6f5f9
commit
6662ce5aab
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=270834
@ -2311,9 +2311,11 @@ fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag,
|
||||
* Report an error if the process doesn't exist
|
||||
* or is actively being birthed.
|
||||
*/
|
||||
sx_slock(&proctree_lock);
|
||||
p = pfind(pid);
|
||||
if (p)
|
||||
fill_kinfo_proc(p, &kp);
|
||||
sx_sunlock(&proctree_lock);
|
||||
if (p == NULL || kp.ki_stat == SIDL) {
|
||||
#if defined(sun)
|
||||
mutex_exit(&pidlock);
|
||||
@ -2377,9 +2379,11 @@ fasttrap_ioctl(struct cdev *dev, u_long cmd, caddr_t arg, int fflag,
|
||||
* Report an error if the process doesn't exist
|
||||
* or is actively being birthed.
|
||||
*/
|
||||
sx_slock(&proctree_lock);
|
||||
p = pfind(pid);
|
||||
if (p)
|
||||
fill_kinfo_proc(p, &kp);
|
||||
sx_sunlock(&proctree_lock);
|
||||
if (p == NULL || kp.ki_stat == SIDL) {
|
||||
#if defined(sun)
|
||||
mutex_exit(&pidlock);
|
||||
|
@ -645,8 +645,10 @@ linprocfs_doprocstat(PFS_FILL_ARGS)
|
||||
static int ratelimit = 0;
|
||||
vm_offset_t startcode, startdata;
|
||||
|
||||
sx_slock(&proctree_lock);
|
||||
PROC_LOCK(p);
|
||||
fill_kinfo_proc(p, &kp);
|
||||
sx_sunlock(&proctree_lock);
|
||||
if (p->p_vmspace) {
|
||||
startcode = (vm_offset_t)p->p_vmspace->vm_taddr;
|
||||
startdata = (vm_offset_t)p->p_vmspace->vm_daddr;
|
||||
@ -722,9 +724,11 @@ linprocfs_doprocstatm(PFS_FILL_ARGS)
|
||||
struct kinfo_proc kp;
|
||||
segsz_t lsize;
|
||||
|
||||
sx_slock(&proctree_lock);
|
||||
PROC_LOCK(p);
|
||||
fill_kinfo_proc(p, &kp);
|
||||
PROC_UNLOCK(p);
|
||||
sx_sunlock(&proctree_lock);
|
||||
|
||||
/*
|
||||
* See comments in linprocfs_doprocstatus() regarding the
|
||||
@ -757,6 +761,7 @@ linprocfs_doprocstatus(PFS_FILL_ARGS)
|
||||
struct sigacts *ps;
|
||||
int i;
|
||||
|
||||
sx_slock(&proctree_lock);
|
||||
PROC_LOCK(p);
|
||||
td2 = FIRST_THREAD_IN_PROC(p); /* XXXKSE pretend only one thread */
|
||||
|
||||
@ -795,6 +800,8 @@ linprocfs_doprocstatus(PFS_FILL_ARGS)
|
||||
}
|
||||
|
||||
fill_kinfo_proc(p, &kp);
|
||||
sx_sunlock(&proctree_lock);
|
||||
|
||||
sbuf_printf(sb, "Name:\t%s\n", p->p_comm); /* XXX escape */
|
||||
sbuf_printf(sb, "State:\t%s\n", state);
|
||||
|
||||
|
@ -1783,8 +1783,10 @@ __elfN(note_procstat_proc)(void *arg, struct sbuf *sb, size_t *sizep)
|
||||
KASSERT(*sizep == size, ("invalid size"));
|
||||
structsize = sizeof(elf_kinfo_proc_t);
|
||||
sbuf_bcat(sb, &structsize, sizeof(structsize));
|
||||
sx_slock(&proctree_lock);
|
||||
PROC_LOCK(p);
|
||||
kern_proc_out(p, sb, ELF_KERN_PROC_MASK);
|
||||
sx_sunlock(&proctree_lock);
|
||||
}
|
||||
*sizep = size;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user