[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RFC: [PATCH] Fix setpriority calling __task_priority() for processes

From: Samuel Thibault
Subject: Re: RFC: [PATCH] Fix setpriority calling __task_priority() for processes instead of threads.
Date: Wed, 31 Aug 2016 12:58:04 +0200
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]