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:	Tue, 14 Jun 2016 11:40:33 +0100
From:	Will Deacon <will.deacon@....com>
To:	xinhui <xinhui.pan@...ux.vnet.ibm.com>
Cc:	linux-arch@...r.kernel.org, linux-kernel@...r.kernel.org,
	arnd@...db.de, waiman.long@...com, peterz@...radead.org
Subject: Re: [PATCH] locking/qrwlock: fix write unlock issue in big endian

On Tue, Jun 14, 2016 at 02:11:48PM +0800, xinhui wrote:
> 
> On 2016年06月08日 17:22, Will Deacon wrote:
> >On Thu, Jun 02, 2016 at 06:09:08PM +0800, Pan Xinhui wrote:
> >>strcut __qrwlock has different layout in big endian machine. we need set
> >>the __qrwlock->wmode to NULL, and the address is not &lock->cnts in big
> >>endian machine.
> >>
> >>Do as what read unlock does. we are lucky that the __qrwlock->wmode's
> >>val is _QW_LOCKED.
> >
> >Doesn't this have wider implications for the qrwlocks, for example:
> >
> >   while ((cnts & _QW_WMASK) == _QW_LOCKED) { ... }
> >
> >would actually end up looking at the wrong field of the lock?
> >
> I does not clearly understand your idea. :(

That's because I'm talking rubbish :) Sorry, I completely confused myself.
Locking is bad enough on its own, but add big-endian to the mix and I'm
all done.

> >Shouldn't we just remove the #ifdef __LITTLE_ENDIAN stuff from __qrwlock,
> >given that all the struct members are u8?
> >
> No. that makes codes complex. for example
> 
> struct __qrwlock lock;
> 
> WRITE_ONCE(lock->wmode, _QW_WAITING);
> if (atomic_(&lock->cnts) == _QW_WAITING) {
> 	do_something();
> }
> 
> IF you remove the  #ifdef __LITTLE_ENDIAN stuff from __qrwlock.
> codes above obviously will break. And we already have such code.

I was wondering more along the lines of having one definition of the data
structure, but then defining _QW_* differently depending on endianness
(i.e. add a << 24 when big-endian). That way queued_write_unlock can
stay like it is (having an arch override to handle the big-endian case
is incredibly ugly).

Will

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ