lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <831c2cd4-40a4-31b2-c0aa-b5f579e770d6@virtuozzo.com>
Date:   Thu, 7 Nov 2019 11:36:50 +0300
From:   Kirill Tkhai <ktkhai@...tuozzo.com>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Quentin Perret <qperret@...gle.com>, linux-kernel@...r.kernel.org,
        aaron.lwe@...il.com, valentin.schneider@....com, mingo@...nel.org,
        pauld@...hat.com, jdesfossez@...italocean.com,
        naravamudan@...italocean.com, vincent.guittot@...aro.org,
        dietmar.eggemann@....com, juri.lelli@...hat.com,
        rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de,
        kernel-team@...roid.com, john.stultz@...aro.org
Subject: Re: NULL pointer dereference in pick_next_task_fair

On 06.11.2019 20:27, Peter Zijlstra wrote:
> On Wed, Nov 06, 2019 at 05:54:37PM +0100, Peter Zijlstra wrote:
>> On Wed, Nov 06, 2019 at 06:51:40PM +0300, Kirill Tkhai wrote:
>>>> +#ifdef CONFIG_SMP
>>>> +	if (!rq->nr_running) {
>>>> +		/*
>>>> +		 * Make sure task_on_rq_curr() fails, such that we don't do
>>>> +		 * put_prev_task() + set_next_task() on this task again.
>>>> +		 */
>>>> +		prev->on_cpu = 2;
>>>>  		newidle_balance(rq, rf);
>>>
>>> Shouldn't we restore prev->on_cpu = 1 after newidle_balance()? Can't prev
>>> become pickable again after newidle_balance() releases rq->lock, and we
>>> take it again, so this on_cpu == 2 never will be cleared?
>>
>> Indeed so.
> 
> Oh wait, the way it was written this is not possible. Because
> rq->nr_running == 0 and prev->on_cpu > 0 it means the current task is
> going to sleep and cannot be woken back up.

I mostly mean throttling. AFAIR, tasks of throttled rt_rq are not accounted
in rq->nr_running. But it seems rt_rq may become unthrottled again after
newidle_balance() unlocks rq lock, and prev will become pickable again.
 
> But if I move the ->on_cpu=2 thing earlier, as I wrote I'd do, then yes,
> we have to set it back to 1. Because in that case we can get here for a
> spurious schedule and we'll pick the same task again.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ