public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 2.6.13rc3: RLIMIT_RTPRIO broken
@ 2005-07-23 11:42 Andreas Steinmetz
  2005-07-23 17:09 ` Lee Revell
  2005-07-26 10:26 ` Ingo Molnar
  0 siblings, 2 replies; 7+ messages in thread
From: Andreas Steinmetz @ 2005-07-23 11:42 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: Linux Kernel Mailinglist

[-- Attachment #1: Type: text/plain, Size: 1376 bytes --]

RLIMIT_RTPRIO is supposed to grant non privileged users the right to use
SCHED_FIFO/SCHED_RR scheduling policies with priorites bounded by the
RLIMIT_RTPRIO value via sched_setscheduler(). This is usually used by
audio users.

Unfortunately this is broken in 2.6.13rc3 as you can see in the excerpt
from sched_setscheduler below:

        /*
         * Allow unprivileged RT tasks to decrease priority:
         */
        if (!capable(CAP_SYS_NICE)) {
                /* can't change policy */
                if (policy != p->policy)
                        return -EPERM;

After the above unconditional test which causes sched_setscheduler to
fail with no regard to the RLIMIT_RTPRIO value the following check is made:

               /* can't increase priority */
                if (policy != SCHED_NORMAL &&
                    param->sched_priority > p->rt_priority &&
                    param->sched_priority >
                                p->signal->rlim[RLIMIT_RTPRIO].rlim_cur)
                        return -EPERM;

Thus I do believe that the RLIMIT_RTPRIO value must be taken into
account for the policy check, especially as the RLIMIT_RTPRIO limit is
of no use without this change.

The attached patch fixes this problem. I would appreciate it if the fix
would make it into 2.6.13.
-- 
Andreas Steinmetz                       SPAMmers use robotrap@domdv.de

[-- Attachment #2: 2.6.13rc3-rtprio.patch --]
[-- Type: text/plain, Size: 405 bytes --]

--- linux.orig/kernel/sched.c	2005-07-22 19:45:05.000000000 +0200
+++ linux/kernel/sched.c	2005-07-22 19:45:42.000000000 +0200
@@ -3528,7 +3528,8 @@
 	 */
 	if (!capable(CAP_SYS_NICE)) {
 		/* can't change policy */
-		if (policy != p->policy)
+		if (policy != p->policy &&
+			!p->signal->rlim[RLIMIT_RTPRIO].rlim_cur)
 			return -EPERM;
 		/* can't increase priority */
 		if (policy != SCHED_NORMAL &&

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] 2.6.13rc3: RLIMIT_RTPRIO broken
  2005-07-23 11:42 [PATCH] 2.6.13rc3: RLIMIT_RTPRIO broken Andreas Steinmetz
@ 2005-07-23 17:09 ` Lee Revell
  2005-07-23 17:26   ` Andreas Steinmetz
  2005-07-26 10:26 ` Ingo Molnar
  1 sibling, 1 reply; 7+ messages in thread
From: Lee Revell @ 2005-07-23 17:09 UTC (permalink / raw)
  To: Andreas Steinmetz
  Cc: Matt Mackall, Linus Torvalds, Andrew Morton,
	Linux Kernel Mailinglist

On Sat, 2005-07-23 at 13:42 +0200, Andreas Steinmetz wrote:
> RLIMIT_RTPRIO is supposed to grant non privileged users the right to use
> SCHED_FIFO/SCHED_RR scheduling policies with priorites bounded by the
> RLIMIT_RTPRIO value via sched_setscheduler(). This is usually used by
> audio users.
>
> Unfortunately this is broken in 2.6.13rc3 as you can see in the excerpt
> from sched_setscheduler below:

Please provide the Signed-Off-By line.  Also I have cc'ed Matt Mackall,
the original author of the patch.

This should definitely make it in 2.6.13.

Lee


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] 2.6.13rc3: RLIMIT_RTPRIO broken
  2005-07-23 17:09 ` Lee Revell
@ 2005-07-23 17:26   ` Andreas Steinmetz
  0 siblings, 0 replies; 7+ messages in thread
From: Andreas Steinmetz @ 2005-07-23 17:26 UTC (permalink / raw)
  To: Lee Revell
  Cc: Matt Mackall, Linus Torvalds, Andrew Morton,
	Linux Kernel Mailinglist

Lee Revell wrote:
> On Sat, 2005-07-23 at 13:42 +0200, Andreas Steinmetz wrote:
> 
>>RLIMIT_RTPRIO is supposed to grant non privileged users the right to use
>>SCHED_FIFO/SCHED_RR scheduling policies with priorites bounded by the
>>RLIMIT_RTPRIO value via sched_setscheduler(). This is usually used by
>>audio users.
>>
>>Unfortunately this is broken in 2.6.13rc3 as you can see in the excerpt
>>from sched_setscheduler below:
> 
> 
> Please provide the Signed-Off-By line.  Also I have cc'ed Matt Mackall,
> the original author of the patch.

Sorry, I do forget this all the time...

Signed-off-by: Andreas Steinmetz <ast@domdv.de>
-- 
Andreas Steinmetz                       SPAMmers use robotrap@domdv.de

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] 2.6.13rc3: RLIMIT_RTPRIO broken
  2005-07-23 11:42 [PATCH] 2.6.13rc3: RLIMIT_RTPRIO broken Andreas Steinmetz
  2005-07-23 17:09 ` Lee Revell
@ 2005-07-26 10:26 ` Ingo Molnar
  2005-07-26 11:56   ` Paolo Ciarrocchi
  1 sibling, 1 reply; 7+ messages in thread
From: Ingo Molnar @ 2005-07-26 10:26 UTC (permalink / raw)
  To: Andreas Steinmetz; +Cc: Linus Torvalds, Andrew Morton, Linux Kernel Mailinglist


* Andreas Steinmetz <ast@domdv.de> wrote:

> RLIMIT_RTPRIO is supposed to grant non privileged users the right to 
> use SCHED_FIFO/SCHED_RR scheduling policies with priorites bounded by 
> the RLIMIT_RTPRIO value via sched_setscheduler(). This is usually used 
> by audio users.
> 
> Unfortunately this is broken in 2.6.13rc3 as you can see in the 
> excerpt from sched_setscheduler below:
> 
>         /*
>          * Allow unprivileged RT tasks to decrease priority:
>          */
>         if (!capable(CAP_SYS_NICE)) {
>                 /* can't change policy */
>                 if (policy != p->policy)
>                         return -EPERM;
> 
> After the above unconditional test which causes sched_setscheduler to
> fail with no regard to the RLIMIT_RTPRIO value the following check is made:
> 
>                /* can't increase priority */
>                 if (policy != SCHED_NORMAL &&
>                     param->sched_priority > p->rt_priority &&
>                     param->sched_priority >
>                                 p->signal->rlim[RLIMIT_RTPRIO].rlim_cur)
>                         return -EPERM;
> 
> Thus I do believe that the RLIMIT_RTPRIO value must be taken into 
> account for the policy check, especially as the RLIMIT_RTPRIO limit is 
> of no use without this change.
> 
> The attached patch fixes this problem. I would appreciate it if the 
> fix would make it into 2.6.13.

[back from KS/OLS]

indeed. The effect of the bug is that RLIMIT_RTPRIO is completely
non-functional in 2.6.12.

Acked-by: Ingo Molnar <mingo@elte.hu>

	Ingo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] 2.6.13rc3: RLIMIT_RTPRIO broken
  2005-07-26 10:26 ` Ingo Molnar
@ 2005-07-26 11:56   ` Paolo Ciarrocchi
  2005-07-26 12:06     ` Ingo Molnar
  0 siblings, 1 reply; 7+ messages in thread
From: Paolo Ciarrocchi @ 2005-07-26 11:56 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Andreas Steinmetz, Linus Torvalds, Andrew Morton,
	Linux Kernel Mailinglist

2005/7/26, Ingo Molnar <mingo@elte.hu>:
[...]
> [back from KS/OLS]
> 
> indeed. The effect of the bug is that RLIMIT_RTPRIO is completely
> non-functional in 2.6.12.
> 
> Acked-by: Ingo Molnar <mingo@elte.hu>

Ingo, Lee, Andreas,
the patch seems to be quite simple and is a fix for a regression.
Is anybody going to FW it to the stable team ?

-- 
paoloc.blogspot.com
paoloc.mindsay.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] 2.6.13rc3: RLIMIT_RTPRIO broken
  2005-07-26 11:56   ` Paolo Ciarrocchi
@ 2005-07-26 12:06     ` Ingo Molnar
  2005-07-26 14:34       ` Lee Revell
  0 siblings, 1 reply; 7+ messages in thread
From: Ingo Molnar @ 2005-07-26 12:06 UTC (permalink / raw)
  To: Paolo Ciarrocchi
  Cc: Andreas Steinmetz, Linus Torvalds, Andrew Morton,
	Linux Kernel Mailinglist


* Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com> wrote:

> 2005/7/26, Ingo Molnar <mingo@elte.hu>:
> [...]
> > [back from KS/OLS]
> > 
> > indeed. The effect of the bug is that RLIMIT_RTPRIO is completely
> > non-functional in 2.6.12.
> > 
> > Acked-by: Ingo Molnar <mingo@elte.hu>
> 
> Ingo, Lee, Andreas,
> the patch seems to be quite simple and is a fix for a regression.
> Is anybody going to FW it to the stable team ?

i'd not put it into stable just yet - the fact that it has not been 
tested in 2.6.12 _at all_ up until very recently means there's little QA 
feedback. Yes, it's simple, but it also triggers something we never did 
before. 2.6.13 ought to be released soon, that should be good enough.

	Ingo

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] 2.6.13rc3: RLIMIT_RTPRIO broken
  2005-07-26 12:06     ` Ingo Molnar
@ 2005-07-26 14:34       ` Lee Revell
  0 siblings, 0 replies; 7+ messages in thread
From: Lee Revell @ 2005-07-26 14:34 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Paolo Ciarrocchi, Andreas Steinmetz, Linus Torvalds,
	Andrew Morton, Linux Kernel Mailinglist

On Tue, 2005-07-26 at 14:06 +0200, Ingo Molnar wrote:
> i'd not put it into stable just yet - the fact that it has not been 
> tested in 2.6.12 _at all_ up until very recently means there's little
> QA feedback. Yes, it's simple, but it also triggers something we never
> did before. 2.6.13 ought to be released soon, that should be good
> enough.

Also, no distro is shipping the updated PAM, glibc, and bash packages
needed to use the new feature yet, even in their development releases.
So there would be very little point in putting this in -stable.

Lee


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-07-26 14:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-23 11:42 [PATCH] 2.6.13rc3: RLIMIT_RTPRIO broken Andreas Steinmetz
2005-07-23 17:09 ` Lee Revell
2005-07-23 17:26   ` Andreas Steinmetz
2005-07-26 10:26 ` Ingo Molnar
2005-07-26 11:56   ` Paolo Ciarrocchi
2005-07-26 12:06     ` Ingo Molnar
2005-07-26 14:34       ` Lee Revell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox