From: tip-bot for Peter Zijlstra <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@kernel.org,
peterz@infradead.org, tglx@linutronix.de,
daniel.lezcano@linaro.org
Subject: [tip:sched/core] sched: Fix __sched_setscheduler() nice test
Date: Thu, 16 Jan 2014 10:39:30 -0800 [thread overview]
Message-ID: <tip-eaad45132c564ce377e6dce05e78e08e456d5315@git.kernel.org> (raw)
In-Reply-To: <20140116165425.GA9481@laptop.programming.kicks-ass.net>
Commit-ID: eaad45132c564ce377e6dce05e78e08e456d5315
Gitweb: http://git.kernel.org/tip/eaad45132c564ce377e6dce05e78e08e456d5315
Author: Peter Zijlstra <peterz@infradead.org>
AuthorDate: Thu, 16 Jan 2014 17:54:25 +0100
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 16 Jan 2014 18:07:08 +0100
sched: Fix __sched_setscheduler() nice test
With the introduction of sched_attr::sched_nice we need to check
if we've got permission to actually change the nice value.
Daniel found that can_nice() would always fail; and upon
inspection it turns out that can_nice() only tests to see if we
can lower the nice value, but it doesn't validate if we're
lowering or not.
Therefore amend the test to only call can_nice() when we lower
the nice value.
Reported-and-Tested-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Cc: raistlin@linux.it
Cc: juri.lelli@gmail.com
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Fixes: d50dde5a10f3 ("sched: Add new scheduler syscalls to support an extended scheduling parameters ABI")
Link: http://lkml.kernel.org/r/20140116165425.GA9481@laptop.programming.kicks-ass.net
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/sched/core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 93a2836..36c951b 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3296,7 +3296,8 @@ recheck:
*/
if (user && !capable(CAP_SYS_NICE)) {
if (fair_policy(policy)) {
- if (!can_nice(p, attr->sched_nice))
+ if (attr->sched_nice < TASK_NICE(p) &&
+ !can_nice(p, attr->sched_nice))
return -EPERM;
}
next prev parent reply other threads:[~2014-01-16 18:40 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-15 8:27 [BUG] [ tip/sched/core ] System unresponsive after booting Daniel Lezcano
2014-01-15 9:22 ` Ingo Molnar
2014-01-15 10:39 ` Peter Zijlstra
2014-01-15 11:00 ` Peter Zijlstra
2014-01-15 14:05 ` Peter Zijlstra
2014-01-15 9:25 ` Michael wang
2014-01-15 11:30 ` Peter Zijlstra
2014-01-15 13:28 ` Daniel Lezcano
2014-01-16 13:40 ` [tip:sched/core] sched: Preserve the nice level over sched_setscheduler() and sched_setparam() calls tip-bot for Peter Zijlstra
2014-01-15 13:27 ` [BUG] [ tip/sched/core ] System unresponsive after booting Daniel Lezcano
2014-01-15 12:04 ` Peter Zijlstra
2014-01-15 12:24 ` Ingo Molnar
2014-01-15 13:45 ` Daniel Lezcano
2014-01-15 13:09 ` Daniel Lezcano
2014-01-16 13:48 ` Daniel Lezcano
2014-01-16 14:17 ` Peter Zijlstra
2014-01-16 14:20 ` Daniel Lezcano
2014-01-16 14:25 ` Peter Zijlstra
2014-01-16 14:30 ` Daniel Lezcano
2014-01-16 15:42 ` Peter Zijlstra
2014-01-16 15:50 ` Daniel Lezcano
2014-01-16 16:54 ` [PATCH] sched: Fix __sched_setscheduler() nice test Peter Zijlstra
2014-01-16 18:33 ` Peter Zijlstra
2014-01-16 18:39 ` tip-bot for Peter Zijlstra [this message]
2014-01-16 15:28 ` [BUG] [ tip/sched/core ] System unresponsive after booting Daniel Lezcano
2014-01-16 15:48 ` Peter Zijlstra
2014-01-16 15:51 ` Daniel Lezcano
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=tip-eaad45132c564ce377e6dce05e78e08e456d5315@git.kernel.org \
--to=tipbot@zytor.com \
--cc=daniel.lezcano@linaro.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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
Powered by JetHome