mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-11 17:04:19 +01:00
Don't forget to check invalid policy!
This commit is contained in:
parent
006faeb831
commit
2dca4ca723
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=160259
@ -128,18 +128,20 @@ create_thread(struct thread *td, mcontext_t *ctx,
|
||||
return (EPROCLIM);
|
||||
|
||||
if (sched != NULL) {
|
||||
/* Only root can set scheduler policy */
|
||||
if (sched->policy != SCHED_OTHER) {
|
||||
switch(sched->policy) {
|
||||
case SCHED_FIFO:
|
||||
case SCHED_RR:
|
||||
/* Only root can set scheduler policy */
|
||||
if (suser(td) != 0)
|
||||
return (EPERM);
|
||||
|
||||
if (sched->policy != SCHED_FIFO &&
|
||||
sched->policy != SCHED_RR)
|
||||
return (EINVAL);
|
||||
|
||||
if (sched->param.sched_priority < RTP_PRIO_MIN ||
|
||||
sched->param.sched_priority > RTP_PRIO_MAX)
|
||||
return (EINVAL);
|
||||
break;
|
||||
case SCHED_OTHER:
|
||||
break;
|
||||
default:
|
||||
return (EINVAL);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user