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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 26 Aug 2011 15:57:39 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Yong Zhang <yong.zhang0@...il.com>
Cc:	Peter Zijlstra <peterz@...radead.org>,
	Frank Rowand <frank.rowand@...sony.com>,
	linux-kernel <linux-kernel@...r.kernel.org>, users@...nel.org,
	hch <hch@...radead.org>, scameron@...rdog.cce.hp.com,
	"James E.J. Bottomley" <jejb@...isc-linux.org>,
	Jens Axboe <jaxboe@...ionio.com>,
	Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [kernel.org users] [KORG] Panics on master backend

On 08/26, Yong Zhang wrote:
>
> On Thu, Aug 25, 2011 at 03:54:29PM +0200, Oleg Nesterov wrote:
> >
> > Of course it is not TASK_RUNNING, but it can be running or not.
>
> Yup. Before we go beyond ttwu_remote() in ttwu(), 'cpu' is not safe.
> For example, wait_event() could be preempted in between.
>
> But after we go beyond ttwu_remote(), ->pi_lock will stabilize it.

Yes.

> So after we take Oleg's suggestion("task_cpu(p) == smp_processor_id()"),
> things we left is just how to account stat correctly.

Imho, we don't really care. This race is very unlikely, and I think
that the "wrong" cpu argument in ttwu_stat() is harmless.

My only point was, this "cpu = task_cpu(p)" looks confusing, as if we
can trust it below, during the actual wakeup.

> @@ -2696,7 +2697,12 @@ try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
>  	success = 1; /* we're going to change ->state */
>  	cpu = task_cpu(p);
>  
> -	if (p->on_rq && ttwu_remote(p, wake_flags))
> +	/*
> +	 * read cpu for another time if ttwu_remote() success,
> +	 * just to prevent task migration in between, otherwise
> +	 * we maybe account stat incorrectly.
> +	 */
> +	if (p->on_rq && ttwu_remote(p, wake_flags, &cpu))

I don't think this makes the things better. p->on_rq can be already
false or ttwu_remote() can fail, in this case we still use the result
of initial task_cpu().

Oleg.

--
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