From owner-freebsd-hackers@FreeBSD.ORG Fri Feb 18 11:20:06 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C047106564A for ; Fri, 18 Feb 2011 11:20:06 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-px0-f182.google.com (mail-px0-f182.google.com [209.85.212.182]) by mx1.freebsd.org (Postfix) with ESMTP id 481E48FC1F for ; Fri, 18 Feb 2011 11:20:06 +0000 (UTC) Received: by pxi1 with SMTP id 1so572904pxi.13 for ; Fri, 18 Feb 2011 03:20:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=fc7OJoLx5pVMHK157o8TP80O7HruHeVf1qPi8PkQ3zA=; b=MGOouZFld9lNNfstIfToq5R12Pf35MC0IkuCn2RXnnIYOeGIP0JpJKNmVD9P89agPq 6S8l1owYtbkzgDwp1N7DgpDYkFCvh0Rvbz7rB1SdwIP/nHzKGdX6mt+jrbxQl/23b2ff zWRmILT8JY7rtiIQ3+J7FDPbWBWo0yt5d3Q2s= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=e1lhFIfAjAKv92jEXo2qzVnTJtEOPeKCeOFLYx7p4E7KF/keoj3heDzCkkXgQFj0aX We8CWi/PzSY5X6Qbwfqxp5CpJAudTr1zaq8JB/WjahwNlNCju6K6ZJCQBLzXkPjjUBhZ Vo0wzXTUrre449IanbMhSrEnHhVQWkqKRhJG4= MIME-Version: 1.0 Received: by 10.142.217.14 with SMTP id p14mr466344wfg.56.1298028005650; Fri, 18 Feb 2011 03:20:05 -0800 (PST) Received: by 10.142.217.5 with HTTP; Fri, 18 Feb 2011 03:20:05 -0800 (PST) In-Reply-To: References: Date: Fri, 18 Feb 2011 14:20:05 +0300 Message-ID: From: Sergey Kandaurov To: Mats Lindberg Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-hackers@freebsd.org Subject: Re: sched_setscheduler() behaviour changed?? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Feb 2011 11:20:06 -0000 On 17 February 2011 12:50, Mats Lindberg wrote: > All, > I have been using a small program /rt) that utilize the sched_setscheduler() > syscall to set the scheduling policy of a process to SCHED_RR. Been running > it FBSD 5.x and 6.x. Now when migrating to FBSD 8.1 I get EPERM back at me. > used to be able to run it like e.g. >> ./rt -sr -p2 -- prog > > which started in SCHED_RR policy with priority 2. > > now in FBSD 8.1 I get EPERM > > But If I do >> rtprio 10 ./rt -sr -p2 -- prog > > it I dont get EPERM. > > I'm always root when doing this. > > My problem is that I have customers that need to run their old 5.x 6.x > applications 'as is' in 8.1 whithout changing anything. > [just thinking aloud] Perhaps, you might have stumbled upon the change in sched_setscheduler() restricting permission to superuser: src/sys/posix4/p1003_1b.c#rev1.24.2.1 MFC revision 1.27. Don't allow non-root user to set a scheduler policy. @@ -195,6 +195,10 @@ int sched_setscheduler(struct thread *td struct thread *targettd; struct proc *targetp; + /* Don't allow non root user to set a scheduler policy */ + if (suser(td) != 0) + return (EPERM); + e = copyin(uap->param, &sched_param, sizeof(sched_param)); if (e) return (e); -- wbr, pluknet