bug-hurd
[Top][All Lists]
Advanced

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

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


From: Svante Signell
Subject: Re: RFC: [PATCH] Fix setpriority calling __task_priority() for processes instead of threads.
Date: Wed, 31 Aug 2016 14:10:22 +0200

On Wed, 2016-08-31 at 13:51 +0200, Samuel Thibault wrote:
> Svante Signell, on Wed 31 Aug 2016 13:42:58 +0200, wrote:
> > 
>
> > Which is the original bug then?
> You didn't say what application you are actually trying to fix, but the
> issue you have shown is that task_priority returns permission denied
> when change_threads is true (and I guessed you want that to work as
> normal user). I just said that the test was expected to have issues
> since the nice value is negative.

The application is openntpd, which I'm working on porting and ntpd where this
call is made requires you to be root.

> Now, it's not normal that a root process can't use a negative number. So
> investigation is needed there.

You are right: Working values are [0, 24], <0 returns EACCESS, >24 returns ESRCH
(irrespective if being root or not).

I would expect values [-20,19] to be OK converted to [5,44] with
#define NICE_TO_MACH_PRIORITY(nice) ((nice) + 25) from hurd/hurd/resource.h
and 
#define invalid_pri(pri) (((pri) < 0) || ((pri) >= NRQS)), where NRQS = 50
from kern/sched.h.
to work.

In fact, according to invalid_pri(pri) the range could be [-26,25]. but that
would not make sense, right?



reply via email to

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