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:	Fri, 08 Dec 2006 13:57:09 +0000
From:	David Howells <dhowells@...hat.com>
To:	Russell King <rmk+lkml@....linux.org.uk>
Cc:	David Howells <dhowells@...hat.com>, Andrew Morton <akpm@...l.org>,
	torvalds@...l.org, davem@...emloft.com, wli@...omorphy.com,
	matthew@....cx, linux-kernel@...r.kernel.org,
	linux-arch@...r.kernel.org
Subject: Re: [PATCH 3/3] WorkStruct: Use direct assignment rather than cmpxchg() 

Russell King <rmk+lkml@....linux.org.uk> wrote:

> These are the constant versions, where the compiler can optimise the
> mask and word offset itself.

So my inclusion of ARM is correct...  Under some circumstances it will write
to the target word when it wouldn't actually make a change:

	static inline int
	____atomic_test_and_set_bit(unsigned int bit, volatile unsigned long *p)
	{
		unsigned long flags;
		unsigned int res;
		unsigned long mask = 1UL << (bit & 31);

		p += bit >> 5;

		raw_local_irq_save(flags);
		res = *p;
		*p = res | mask;
		raw_local_irq_restore(flags);

		return res & mask;
	}

Remember: *p is volatile.

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