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] [day] [month] [year] [list]
Date:	Tue, 12 Dec 2006 10:37:15 +0000
From:	David Howells <dhowells@...hat.com>
To:	linux@...izon.com
Cc:	nickpiggin@...oo.com.au, linux-arch@...r.kernel.org,
	linux-arm-kernel@...ts.arm.linux.org.uk,
	linux-kernel@...r.kernel.org, torvalds@...l.org
Subject: Re: [PATCH] WorkStruct: Implement generic UP cmpxchg() where an 

linux@...izon.com wrote:

> do {
> 	oldvalue = ll(addr)
> 	newvalue = ... oldvalue ...
> } while (!sc(addr, oldvalue, newvalue))
> 
> Where sc() could be a cmpxchg.  But, more importantly, if the
> architecture did implement LL/SC, it could be a "try plain SC; if
> that fails try CMPXCHG built out of LL/SC; if that fails, loop"

If sc() is implemented with cmpxchg(), then this is a very silly piece of
code.  cmpxchg() returns the current value if it fails, rendering a repetition
of ll() pointless.  In some circumstances, you should really do it by putting
the cmpxchg() up front with what you expect the most likely substitution to
be, and that then doesn't require the initial load.

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