summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_ktrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_ktrace.c')
-rw-r--r--sys/kern/kern_ktrace.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c
index db44873..6fc46d6 100644
--- a/sys/kern/kern_ktrace.c
+++ b/sys/kern/kern_ktrace.c
@@ -350,16 +350,24 @@ ktrace(td, uap)
/*
* by process group
*/
+ PGRPSESS_SLOCK();
pg = pgfind(-uap->pid);
if (pg == NULL) {
+ PGRPSESS_SUNLOCK();
error = ESRCH;
goto done;
}
+ /*
+ * ktrops() may call vrele(). Lock pg_members
+ * by the pgrpsess_lock rather than pg_mtx.
+ */
+ PGRP_UNLOCK(pg);
LIST_FOREACH(p, &pg->pg_members, p_pglist)
if (descend)
ret |= ktrsetchildren(curp, p, ops, facs, vp);
else
ret |= ktrops(curp, p, ops, facs, vp);
+ PGRPSESS_SUNLOCK();
} else {
/*
* by pid
OpenPOWER on IntegriCloud