From: Andrew Morton <akpm@osdl.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: ocroquette@free.fr, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Changing RT priority in kernel 2.6 without CAP_SYS_NICE
Date: Mon, 25 Apr 2005 22:00:40 -0700 [thread overview]
Message-ID: <20050425220040.7e876ce5.akpm@osdl.org> (raw)
In-Reply-To: <20050418080750.GA20811@elte.hu>
Ingo Molnar <mingo@elte.hu> wrote:
>
> Presently, a process without the capability CAP_SYS_NICE can not change
> its own policy, which is OK.
>
> But it can also not decrease its RT priority (if scheduled with policy
> SCHED_RR or SCHED_FIFO), which is what this patch changes.
This patch needed some massaging to copt with the changes in
nice-and-rt-prio-rlimits.patch - please check.
I guess we should merge nice-and-rt-prio-rlimits.patch.
--- 25/kernel/sched.c~sched-changing-rt-priority-without-cap_sys_nice 2005-04-25 21:54:48.572295312 -0700
+++ 25-akpm/kernel/sched.c 2005-04-25 21:59:18.160311704 -0700
@@ -3445,13 +3445,24 @@ recheck:
if ((policy == SCHED_NORMAL) != (param->sched_priority == 0))
return -EINVAL;
- if ((policy == SCHED_FIFO || policy == SCHED_RR) &&
- param->sched_priority > p->signal->rlim[RLIMIT_RTPRIO].rlim_cur &&
- !capable(CAP_SYS_NICE))
- return -EPERM;
- if ((current->euid != p->euid) && (current->euid != p->uid) &&
- !capable(CAP_SYS_NICE))
- return -EPERM;
+ /*
+ * Allow unprivileged RT tasks to decrease priority:
+ */
+ if (!capable(CAP_SYS_NICE)) {
+ /* can't change policy */
+ if (policy != p->policy)
+ return -EPERM;
+ /* 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;
+ /* can't change other user's priorities */
+ if ((current->euid != p->euid) &&
+ (current->euid != p->uid))
+ return -EPERM;
+ }
retval = security_task_setscheduler(p, policy, param);
if (retval)
_
next prev parent reply other threads:[~2005-04-26 5:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-17 15:38 Olivier Croquette
2005-04-18 8:07 ` Ingo Molnar
2005-04-26 5:00 ` Andrew Morton [this message]
2005-04-26 6:15 ` Olivier Croquette
2005-04-26 8:13 ` Ingo Molnar
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=20050425220040.7e876ce5.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=ocroquette@free.fr \
/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
all inboxes | Powered by JetHome®