svn commit: r367572 - head/sys/kern

Mateusz Guzik mjg at FreeBSD.org
Tue Nov 10 18:10:51 UTC 2020


Author: mjg
Date: Tue Nov 10 18:10:50 2020
New Revision: 367572
URL: https://svnweb.freebsd.org/changeset/base/367572

Log:
  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

Modified:
  head/sys/kern/kern_resource.c

Modified: head/sys/kern/kern_resource.c
==============================================================================
--- head/sys/kern/kern_resource.c	Tue Nov 10 18:07:13 2020	(r367571)
+++ head/sys/kern/kern_resource.c	Tue Nov 10 18:10:50 2020	(r367572)
@@ -315,8 +315,7 @@ sys_rtprio_thread(struct thread *td, struct rtprio_thr
 		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;


More information about the svn-src-head mailing list