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

Showing the changes to kernel (1 of 1 file). Show all

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
36623662 if (retval)
36633663 return retval;
36643664
3665+ if (attr.sched_policy < 0)
3666+ return -EINVAL;
3667+
36653668 rcu_read_lock();
36663669 retval = -ESRCH;
36673670 p = find_process_by_pid(pid);