diff options
author | Dhaval Giani <dhaval@linux.vnet.ibm.com> | 2009-02-27 04:43:54 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-27 05:11:53 -0500 |
commit | 54e991242850edc8c53f71fa5aa3ba7a93ce38f5 (patch) | |
tree | 7f136214aab690a8ee4a294ca9c1a7e01de0dc49 /include | |
parent | cac64d00c256e65776d575e82aaf540632b66178 (diff) |
sched: don't allow setuid to succeed if the user does not have rt bandwidth
Impact: fix hung task with certain (non-default) rt-limit settings
Corey Hickey reported that on using setuid to change the uid of a
rt process, the process would be unkillable and not be running.
This is because there was no rt runtime for that user group. Add
in a check to see if a user can attach an rt task to its task group.
On failure, return EINVAL, which is also returned in
CONFIG_CGROUP_SCHED.
Reported-by: Corey Hickey <bugfood-ml@fatooh.org>
Signed-off-by: Dhaval Giani <dhaval@linux.vnet.ibm.com>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/sched.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/sched.h b/include/linux/sched.h index 8981e52c714f..8c216e057c94 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -2291,9 +2291,13 @@ extern long sched_group_rt_runtime(struct task_group *tg); | |||
2291 | extern int sched_group_set_rt_period(struct task_group *tg, | 2291 | extern int sched_group_set_rt_period(struct task_group *tg, |
2292 | long rt_period_us); | 2292 | long rt_period_us); |
2293 | extern long sched_group_rt_period(struct task_group *tg); | 2293 | extern long sched_group_rt_period(struct task_group *tg); |
2294 | extern int sched_rt_can_attach(struct task_group *tg, struct task_struct *tsk); | ||
2294 | #endif | 2295 | #endif |
2295 | #endif | 2296 | #endif |
2296 | 2297 | ||
2298 | extern int task_can_switch_user(struct user_struct *up, | ||
2299 | struct task_struct *tsk); | ||
2300 | |||
2297 | #ifdef CONFIG_TASK_XACCT | 2301 | #ifdef CONFIG_TASK_XACCT |
2298 | static inline void add_rchar(struct task_struct *tsk, ssize_t amt) | 2302 | static inline void add_rchar(struct task_struct *tsk, ssize_t amt) |
2299 | { | 2303 | { |