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.0611181656230.23270-100000@netrider.rowland.org>
Date:	Sat, 18 Nov 2006 17:13:16 -0500 (EST)
From:	Alan Stern <stern@...land.harvard.edu>
To:	Oleg Nesterov <oleg@...sign.ru>
cc:	"Paul E. McKenney" <paulmck@...ibm.com>,
	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	Kernel development list <linux-kernel@...r.kernel.org>
Subject: Re: [patch] cpufreq: mark cpufreq_tsc() as core_initcall_sync

On Sun, 19 Nov 2006, Oleg Nesterov wrote:

> On 11/18, Alan Stern wrote:
> >
> > By the way, I think the fastpath for synchronize_srcu() should be safe, 
> > now that you have added the memory barriers into srcu_read_lock() and 
> > srcu_read_unlock().  You might as well try putting it in.
> 
> I still think the fastpath should do mb() unconditionally to be correct.

Yes, it definitely should.

> > Although now that I look at it again, you have forgotten to put smp_mb()
> > after the atomic_inc() call and before the atomic_dec().
> 
> As I see it, currently we don't need this barrier because synchronize_srcu()
> does synchronize_sched() before reading ->hardluckref.
> 
> But if we add the fastpath into synchronize_srcu() then yes, we need mb()
> after atomic_inc().
> 
> Unless I totally confused :)

Put it this way: If the missing memory barrier in srcu_read_lock() after
the atomic_inc call isn't needed, then neither is the existing memory
barrier after the per-cpu counter gets incremented.  Likewise, if a memory
barrier isn't needed before the atomic_dec in srcu_read_unlock(), then
neither is the memory barrier before the per-cpu counter gets decremented.

What you're ignoring is the synchronize_sched() call at the end of
synchronize_srcu(), which has been replaced with smp_mb().  The smp_mb()
needs to pair against a memory barrier on the read side, and that memory
barrier has to occur after srcu_read_lock() has incremented the counter
and before the read-side critical section begins.  Otherwise code in the
critical section might leak out to before the counter is incremented.

Alan Stern

-
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