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] [day] [month] [year] [list]
Date:	Tue, 16 Jul 2013 00:22:24 +0400
From:	Kirill Tkhai <tkhai@...dex.ru>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Steven Rostedt <rostedt@...dmis.org>,
	Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH] sched: Add logic to handle parallel try_to_wake_up() of the same task

16.07.2013, 00:19, "Peter Zijlstra" <peterz@...radead.org>:
> On Mon, Jul 15, 2013 at 06:14:34PM +0400, Kirill Tkhai wrote:
>
>>>>    #ifdef CONFIG_SMP
>>>>   + p->state = TASK_WAKING;
>>>>   + smp_wmb();
>>>>   +
>>>  This too is broken; the loop below needs to be completed first,
>>>  otherwise we change p->state while the task is still on the CPU and it
>>>  might read the wrong p->state.
>>  This place is below (on_rq && ttwu_remote) check, so the task
>>  either 'dequeued and on_cpu == 0'
>>  or it's in the middle of schedule() on arch, which wants unlocked
>>  context switch.
>>
>>  Nobody scheduler's probes p->state between prepare_lock_switch() and
>>  finish_lock_switch(). Archs with unlocked ctx switch (mips and ia64)
>>  don't change or probe state of previous process during context_switch.
>
> It means its after deactivate_task(), but before context_switch(). It so
> happens that
> context_switch()->prepare_task_switch()->trace_sched_switch() inspects
> p->state.
>
> Even if this was not the case, touching a task that is 'life' on another
> CPU is very _very_ bad practise.

Thanks for the explanation.

Kirill
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ