From owner-freebsd-hackers Wed Jun 19 11:13:57 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from ns0.seaman.net (ns0.seaman.net [168.215.64.186]) by hub.freebsd.org (Postfix) with ESMTP id D7F1937B406 for ; Wed, 19 Jun 2002 11:13:46 -0700 (PDT) Received: from tbird.internal.seaman.net (tbird [192.168.10.12]) by ns0.seaman.net (8.12.3/8.12.3) with ESMTP id g5JIDheR083324; Wed, 19 Jun 2002 13:13:44 -0500 (CDT) (envelope-from dick@seaman.org) Received: (from dick@localhost) by tbird.internal.seaman.net (8.11.6/8.11.6) id g5JIDhM31303; Wed, 19 Jun 2002 13:13:43 -0500 Date: Wed, 19 Jun 2002 13:13:42 -0500 From: "Richard Seaman, Jr." To: Peter Edwards Cc: "Richard Seaman, Jr." , hackers@FreeBSD.ORG Subject: Re: sched_setscheduler() permissions and the linux JDK 1.4 Message-ID: <20020619131342.I20472@seaman.org> Mail-Followup-To: "Richard Seaman, Jr." , Peter Edwards , hackers@FreeBSD.ORG References: <20020619171916.586D537B414@hub.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="+HP7ph2BbKc20aGI" Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.2.5.1i In-Reply-To: <20020619171916.586D537B414@hub.freebsd.org>; from pmedwards@eircom.net on Wed, Jun 19, 2002 at 06:19:15PM +0100 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --+HP7ph2BbKc20aGI Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Wed, Jun 19, 2002 at 06:19:15PM +0100, Peter Edwards wrote: > "Richard Seaman, Jr." wrote: > > > sched_setscheduler/sched_getscheduler are broken, permission wise, in > > both stable and current. In stable, permissions are too unreasonably > > restrictive, and in current too unreasonably loose. > > Can you either describe what would be acceptable, or point me to > somewhere that does? (Without having to fork out €BIGNUM to a standards > body.) > > If I can get a decent description, I'm sure I can come up with something > that comes closer to the standard, and doesnt produce as many unpleasant > surprises for linux apps. I'm not aware of any standard for permissions. But, the permissions in rtprio(2) are probably right for sched_get/setscheduler and sched_get/setparam. I have a patch for the permissions in current, but this is just a temporary hack because there are deeper issues. I've attached it. > > However, the sched_XXXX functions are mostly broken anyway. > > In what way? Is there something broken in their local implementation, > a lack of semantically adequate mappings to the FreeBSD scheduler, or > a general lack of functionality in the BSD rtprio stuff it maps to? All the above. Its been on my "todo" list for quite a while to try to describe and fix the brokenness. The list is too long for a simple message. And, there are different issues in current vs. stable. -- Richard Seaman, Jr. email: dick@seaman.org 5182 N. Maple Lane phone: 262-367-5450 Nashotah WI 53058 fax: 262-367-5852 --+HP7ph2BbKc20aGI Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=diff Index: p1003_1b.c =================================================================== RCS file: /home/ncvs/src/sys/posix4/p1003_1b.c,v retrieving revision 1.19 diff -u -r1.19 p1003_1b.c --- p1003_1b.c 19 May 2002 00:14:49 -0000 1.19 +++ p1003_1b.c 2 Jun 2002 18:26:53 -0000 @@ -201,6 +201,10 @@ targettd = td; PROC_LOCK(targetp); } else { + if (suser(td) != 0) { + e = EPERM; + goto done2; + } targetp = pfind(uap->pid); if (targetp == NULL) { e = ESRCH; @@ -210,6 +214,8 @@ } e = p_cansched(td, targetp); + if (e == 0 && uap->policy != SCHED_OTHER && suser(td) != 0) + e = EPERM; PROC_UNLOCK(targetp); if (e == 0) { e = ksched_setscheduler(&td->td_retval[0], ksched, targettd, --+HP7ph2BbKc20aGI-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message