DF-2794 / fix.diff
--- a/sys/kern/kern_resource.c 2026-06-29 12:51:19.000000000 +0000 +++ b/sys/kern/kern_resource.c 2026-10-26 00:25:42.773043131 +0000 @@ -588,9 +588,18 @@ if (uap->tid == -1) { /* * sadly, tid can be 0 so we can't use 0 here - * like sys_rtprio() + * like sys_rtprio(). Resolve the first LWP of the + * TARGET process, not the caller. */ - lp = curthread->td_lwp; + if (p == curproc) { + lp = curthread->td_lwp; + } else { + lp = RB_ROOT(&p->p_lwp_tree); + if (lp == NULL) { + error = ESRCH; + goto done; + } + } } else { lp = lwp_rb_tree_RB_LOOKUP(&p->p_lwp_tree, uap->tid); if (lp == NULL) { |