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]
Date:	Fri, 11 Jun 2010 16:46:48 -0400
From:	Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: sequence lock in Linux

* Paul E. McKenney (paulmck@...ux.vnet.ibm.com) wrote:
> On Fri, Jun 11, 2010 at 03:40:16PM -0400, Mathieu Desnoyers wrote:
> > Hi Paul,
> > 
> > (CCing lkml)
> > 
> > Is it just me, or the following code:
> > 
> > static __always_inline unsigned read_seqbegin(const seqlock_t *sl)
> > {
> >         unsigned ret;
> > 
> > repeat:
> >         ret = sl->sequence;
> >         smp_rmb();
> >         if (unlikely(ret & 1)) {
> >                 cpu_relax();
> >                 goto repeat;
> >         }
> > 
> >         return ret;
> > }
> > 
> > could use a ACCESS_ONCE() around the sl->sequence read ? I'm concerned about the
> > compiler generating code that reads the sequence number chunkwise.
> > 
> > The same apply to all other reads of the sequence number in seqlock.h (including
> > the retry code).
> > 
> > Thoughts ?
> 
> Doesn't gcc guarantee that accesses to aligned basic types that fit into
> a machine word are loaded and stored in one shot?  Now, gcc might choose
> to load twice (or to merge loads) due to things like register pressure,
> but given that ->sequence is an int, gcc should not be accessing it
> (say) bytewise on any platform supporting 32-bit accesses.
> 
> Or am I suffering from wishful thinking here?

Hopefully not. I might be the one suffering from extreme compiler distrust here.
;-)

Mathieu

> 
> 							Thanx, Paul

-- 
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
--
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