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: <Pine.LNX.4.44L0.0611271608470.2786-100000@iolanthe.rowland.org>
Date:	Mon, 27 Nov 2006 16:10:27 -0500 (EST)
From:	Alan Stern <stern@...land.harvard.edu>
To:	Oleg Nesterov <oleg@...sign.ru>
cc:	"Paul E. McKenney" <paulmck@...ibm.com>,
	Kernel development list <linux-kernel@...r.kernel.org>
Subject: Re: [patch] cpufreq: mark cpufreq_tsc() as core_initcall_sync

On Mon, 27 Nov 2006, Oleg Nesterov wrote:

> I still can't relax, another attempt to "prove" this should not be
> possible on CPUs supported by Linux :)
> 
> Let's suppose it is possible, then it should also be possible if CPU_1
> does spin_lock() instead of mb() (spin_lock can't be "stronger"), yes?
> 
> Now,
> 
> 	int COND;
> 	wait_queue_head_t wq;
> 
> 	my_wait()
> 	{
> 		add_wait_queue(&wq);
> 		for (;;) {
> 			set_current_state(TASK_UNINTERRUPTIBLE);
> 
> 			if (COND)
> 				break;
> 
> 			schedule();
> 		}
> 		remove_wait_queue(&wq);
> 	}
> 
> 	my_wake()
> 	{
> 		COND = 1;
> 		wake_up(&wq);
> 	}
> 
> this should be correct, but it is not!
> 
> my_wait:
> 
> 	task->state = TASK_UNINTERRUPTIBLE;		// STORE
> 
> 	mb();
> 
> 	if (COND) break;				// LOAD
> 
> 
> my_wake:
> 
> 	COND = 1;					// STORE
> 
> 	spin_lock(WQ.lock);
> 	spin_lock(runqueue.lock);
> 
> 	// try_to_wake_up()
> 	if (!(task->state & TASK_UNINTERRUPTIBLE))	// LOAD
> 		goto out;
> 
> 
> So, my_wait() gets COND == 0, and goes to schedule in 'D' state.
> try_to_wake_up() reads ->state == TASK_RUNNING, and does nothing.

This is a very good point.  I don't know what the resolution is; Paul will 
have to explain the situation.

Alan

-
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