sched_setscheduler() behaviour changed??
pluknet at gmail.com
Fri Feb 18 11:20:06 UTC 2011
On 17 February 2011 12:50, Mats Lindberg <mats.w.lindberg at gmail.com> wrote:
> I have been using a small program /rt) that utilize the sched_setscheduler()
> syscall to set the scheduling policy of a process to SCHED_RR. Been running
> it FBSD 5.x and 6.x. Now when migrating to FBSD 8.1 I get EPERM back at me.
> used to be able to run it like e.g.
>> ./rt -sr -p2 -- prog
> which started <prog> in SCHED_RR policy with priority 2.
> now in FBSD 8.1 I get EPERM
> But If I do
>> rtprio 10 ./rt -sr -p2 -- prog
> it I dont get EPERM.
> I'm always root when doing this.
> My problem is that I have customers that need to run their old 5.x 6.x
> applications 'as is' in 8.1 whithout changing anything.
[just thinking aloud]
Perhaps, you might have stumbled upon the change in
sched_setscheduler() restricting permission to superuser:
MFC revision 1.27.
Don't allow non-root user to set a scheduler policy.
@@ -195,6 +195,10 @@ int sched_setscheduler(struct thread *td
struct thread *targettd;
struct proc *targetp;
+ /* Don't allow non root user to set a scheduler policy */
+ if (suser(td) != 0)
+ return (EPERM);
e = copyin(uap->param, &sched_param, sizeof(sched_param));
More information about the freebsd-hackers