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.
Unified · Split
| @@ -3662,6 +3662,9 @@ SYSCALL_DEFINE3(sched_setattr, pid_t, pid, struct sched_attr __user *, uattr, · 3661 unmodified lines | ||
| 3662 | 3662 | if (retval) |
| 3663 | 3663 | return retval; |
| 3664 | 3664 | |
| 3665 | + if (attr.sched_policy < 0) | |
| 3666 | + return -EINVAL; | |
| 3667 | + | |
| 3665 | 3668 | rcu_read_lock(); |
| 3666 | 3669 | retval = -ESRCH; |
| 3667 | 3670 | p = find_process_by_pid(pid); |