History

sched: Disallow sched_attr::sched_policy < 0

The scheduler uses policy=-1 to preserve the current policy state to implement sys_sched_setparam(), this got exposed to userspace by accident through sys_sched_setattr(), cure this.

Peter Zijlstra committed 12 years ago

Commit dbdb2271 parent 143cf231 file · +3 −0Browse files

Unified · Split

kernel/sched/core.c+3−0
@@ -3662,6 +3662,9 @@ SYSCALL_DEFINE3(sched_setattr, pid_t, pid, struct sched_attr __user *, uattr, · 3661 unmodified lines
3662 if (retval)3662 if (retval)
3663 return retval;3663 return retval;
3664 3664
3665 if (attr.sched_policy < 0)
3666 return -EINVAL;
3667
3665 rcu_read_lock();3668 rcu_read_lock();
3666 retval = -ESRCH;3669 retval = -ESRCH;
3667 p = find_process_by_pid(pid);3670 p = find_process_by_pid(pid);