aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorBjoern B. Brandenburg <bbb@cs.unc.edu>2007-10-04 22:04:10 -0400
committerBjoern B. Brandenburg <bbb@cs.unc.edu>2007-10-04 22:04:10 -0400
commit0ee9d55ca4d52506ce16ce51959eb59d0cb2d98f (patch)
tree78b75767b1ffa40f9dec4d242d4d0820ceea9dd8 /kernel
parent197eb6ab50c2b60963bc62a10501df0a0fdb133a (diff)
Fix long standing set_rt_params race by disallowing it.
There really is no reason why RT params of a RT task should be changed. The sporadic task model does not allow for it, the schedulers don't expect it, and adaptive tasks will be implemented differently.
Diffstat (limited to 'kernel')
-rw-r--r--kernel/litmus.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/kernel/litmus.c b/kernel/litmus.c
index 6b5022ea94..2c545092b8 100644
--- a/kernel/litmus.c
+++ b/kernel/litmus.c
@@ -70,7 +70,9 @@ asmlinkage long sys_set_rt_mode(int newmode)
70 * EINVAL if either period or execution cost is <=0 70 * EINVAL if either period or execution cost is <=0
71 * 0 if success 71 * 0 if success
72 * 72 *
73 * FIXME: This code is racy during real-time mode. 73 * Only non-real-time tasks may be configured with this system call
74 * to avoid races with the scheduler. In practice, this means that a
75 * task's parameters must be set _before_ calling sys_prepare_rt_task()
74 */ 76 */
75asmlinkage long sys_set_rt_task_param(pid_t pid, rt_param_t __user * param) 77asmlinkage long sys_set_rt_task_param(pid_t pid, rt_param_t __user * param)
76{ 78{
@@ -93,7 +95,16 @@ asmlinkage long sys_set_rt_task_param(pid_t pid, rt_param_t __user * param)
93 if (!(target = find_task_by_pid(pid))) { 95 if (!(target = find_task_by_pid(pid))) {
94 retval = -ESRCH; 96 retval = -ESRCH;
95 goto out_unlock; 97 goto out_unlock;
98 }
99
100 if (is_realtime(target)) {
101 /* The task is already a real-time task.
102 * We cannot not allow parameter changes at this point.
103 */
104 retval = -EPERM;
105 goto out_unlock;
96 } 106 }
107
97 if (tp.exec_cost <= 0) 108 if (tp.exec_cost <= 0)
98 goto out_unlock; 109 goto out_unlock;
99 if (tp.period <= 0) 110 if (tp.period <= 0)