mirror of
https://github.com/torvalds/linux.git
synced 2026-10-07 05:31:08 -04:00
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. Reported-by: Michael Kerrisk <[email protected]> Signed-off-by: Peter Zijlstra <[email protected]> Acked-by: Michael Kerrisk <[email protected]> Cc: <[email protected]> Cc: Linus Torvalds <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
1 parent
143cf23df2
commit
dbdb22754f
1 file changed
+3
@@ -3662,6 +3662,9 @@ SYSCALL_DEFINE3(sched_setattr, pid_t, pid, struct sched_attr __user *, uattr,
|
||||
if (retval)
|
||||
return retval;
|
||||
|
||||
if (attr.sched_policy < 0)
|
||||
return -EINVAL;
|
||||
|
||||
rcu_read_lock();
|
||||
retval = -ESRCH;
|
||||
p = find_process_by_pid(pid);
|
||||
|
||||
Reference in new issue
Block a user