Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Nov 2020 18:10:51 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r367572 - head/sys/kern
Message-ID:  <202011101810.0AAIApms017211@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202011101810.0AAIApms017211>