Svante Signell, on Wed 31 Aug 2016 12:35:26 +0200, wrote:
> The attached patch changes this fixing the previous:
> check_setpriority: can't set priority: Permission denied
> 
> -       prierr = __task_priority (task, NICE_TO_MACH_PRIORITY (prio), 1);
> +       prierr = __task_priority (task, NICE_TO_MACH_PRIORITY (prio), 0);

Err, but then that makes change_threads false, i.e. the task_priority()
call will not change the priorities of all threads of the task, which as
you say is the POSIX behavior:

> According to setpriority(2) and POSIX the nice value should be
> per-process not per-thread.

So this "fix" your testcase by making the function not do what it is
supposed to do...

Re-read your test again: it requests nice -19, i.e. something which is
reserved to root. No wonder you are getting a permission denied. The
actual bug here is that task_priority seems not to check whether the
priority is allowed when change_threads is false.

Samuel

Reply via email to