Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 3303
b: refs/heads/master
c: 37e4ab3
h: refs/heads/master
i:
  3301: ac90ebf
  3299: b1e50c9
  3295: ff24905
v: v3
  • Loading branch information
Olivier Croquette authored and Linus Torvalds committed Jun 25, 2005
1 parent 0d9f840 commit 63aa9c1
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a3464a102a69a4e00efb0a763e274ce290995b4b
refs/heads/master: 37e4ab3f0cba13adf3535d373fd98e5ee47b5410
25 changes: 18 additions & 7 deletions trunk/kernel/sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -3531,13 +3531,24 @@ int sched_setscheduler(struct task_struct *p, int policy, struct sched_param *pa
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)
Expand Down

0 comments on commit 63aa9c1

Please sign in to comment.