Allow rtprio_thread to operate on threads of any process

This in particular unbreaks rtkit.

The limitation was a leftover of previous state, to quote a
comment:

/*
 * Though lwpid is unique, only current process is supported
 * since there is no efficient way to look up a LWP yet.
 */

Long since then a global tid hash was introduced to remedy
the problem.

Permission checks still apply.

Submitted by:	greg_unrelenting.technology (Greg V)
Differential Revision:	https://reviews.freebsd.org/D27158
This commit is contained in:
Mateusz Guzik 2020-11-10 18:10:50 +00:00
parent ad83469d76
commit 5c5ca843b7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=367572

View File

@ -315,8 +315,7 @@ sys_rtprio_thread(struct thread *td, struct rtprio_thread_args *uap)
td1 = td;
PROC_LOCK(p);
} else {
/* Only look up thread in current process */
td1 = tdfind(uap->lwpid, curproc->p_pid);
td1 = tdfind(uap->lwpid, -1);
if (td1 == NULL)
return (ESRCH);
p = td1->td_proc;