DragonFlyBSD Kernel Audit
DF-2793 / fix.diff
← back to finding ↓ download raw
--- a/sys/kern/kern_resource.c
+++ b/sys/kern/kern_resource.c
@@ -581,6 +581,15 @@
 	}
 	lwkt_gettoken(&p->p_token);
 
+	/*
+	 * Jail confinement: like getpriority/setpriority, do not let a
+	 * jailed process observe or modify another jail's processes.
+	 */
+	if (!PRISON_CHECK(curthread->td_ucred, p->p_ucred)) {
+		error = ESRCH;
+		goto done;
+	}
+
 	if (uap->tid < -1) {
 		error = EINVAL;
 		goto done;
@@ -700,6 +709,12 @@
 	}
 	lwkt_gettoken(&p->p_token);
 
+	/* Jail confinement, see sys_lwp_rtprio() above. */
+	if (!PRISON_CHECK(curthread->td_ucred, p->p_ucred)) {
+		error = ESRCH;
+		goto done;
+	}
+
 	/* XXX lwp */
 	lp = FIRST_LWP_IN_PROC(p);
 	switch (uap->function) {