From: Andreas Steinmetz <ast@domdv.de>
To: Linus Torvalds <torvalds@osdl.org>, Andrew Morton <akpm@osdl.org>
Cc: Linux Kernel Mailinglist <linux-kernel@vger.kernel.org>
Subject: [PATCH] 2.6.13rc3: RLIMIT_RTPRIO broken
Date: Sat, 23 Jul 2005 13:42:04 +0200 [thread overview]
Message-ID: <42E22D0C.1010608@domdv.de> (raw)
[-- 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 &&
next reply other threads:[~2005-07-23 11:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-23 11:42 Andreas Steinmetz [this message]
2005-07-23 17:09 ` [PATCH] 2.6.13rc3: RLIMIT_RTPRIO broken 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42E22D0C.1010608@domdv.de \
--to=ast@domdv.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox