public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6.27-rc1] sparc64: FUTEX_OP_ANDN fix
@ 2008-07-30 22:14 Mikael Pettersson
  2008-07-30 22:40 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Mikael Pettersson @ 2008-07-30 22:14 UTC (permalink / raw)
  To: davem; +Cc: linux-kernel, sparclinux

Correct sparc64's implementation of FUTEX_OP_ANDN to do a
bitwise negate of the oparg parameter before applying the
AND operation. All other archs that support FUTEX_OP_ANDN
either negate oparg explicitly (frv, ia64, mips, sh, x86),
or do so indirectly by using an and-not instruction (powerpc).
Since sparc64 has and-not, I chose to use that solution.

I've not found any use of FUTEX_OP_ANDN in glibc so the
impact of this bug is probably minor. But other user-space
components may try to use it so it should still get fixed.

Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
---

diff -rupN linux-2.6.27-rc1/arch/sparc/include/asm/futex_64.h linux-2.6.27-rc1.sparc64-FUTEX_OP_ANDN-fix/arch/sparc/include/asm/futex_64.h
--- linux-2.6.27-rc1/arch/sparc/include/asm/futex_64.h	2008-07-29 10:40:10.000000000 +0200
+++ linux-2.6.27-rc1.sparc64-FUTEX_OP_ANDN-fix/arch/sparc/include/asm/futex_64.h	2008-07-30 22:22:43.000000000 +0200
@@ -59,7 +59,7 @@ static inline int futex_atomic_op_inuser
 		__futex_cas_op("or\t%2, %4, %1", ret, oldval, uaddr, oparg);
 		break;
 	case FUTEX_OP_ANDN:
-		__futex_cas_op("and\t%2, %4, %1", ret, oldval, uaddr, oparg);
+		__futex_cas_op("andn\t%2, %4, %1", ret, oldval, uaddr, oparg);
 		break;
 	case FUTEX_OP_XOR:
 		__futex_cas_op("xor\t%2, %4, %1", ret, oldval, uaddr, oparg);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 2.6.27-rc1] sparc64: FUTEX_OP_ANDN fix
  2008-07-30 22:14 [PATCH 2.6.27-rc1] sparc64: FUTEX_OP_ANDN fix Mikael Pettersson
@ 2008-07-30 22:40 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-07-30 22:40 UTC (permalink / raw)
  To: mikpe; +Cc: linux-kernel, sparclinux

From: Mikael Pettersson <mikpe@it.uu.se>
Date: Thu, 31 Jul 2008 00:14:58 +0200 (MEST)

> Correct sparc64's implementation of FUTEX_OP_ANDN to do a
> bitwise negate of the oparg parameter before applying the
> AND operation. All other archs that support FUTEX_OP_ANDN
> either negate oparg explicitly (frv, ia64, mips, sh, x86),
> or do so indirectly by using an and-not instruction (powerpc).
> Since sparc64 has and-not, I chose to use that solution.
> 
> I've not found any use of FUTEX_OP_ANDN in glibc so the
> impact of this bug is probably minor. But other user-space
> components may try to use it so it should still get fixed.
> 
> Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>

Thanks a lot for this fix, I'll apply it!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-07-30 22:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-30 22:14 [PATCH 2.6.27-rc1] sparc64: FUTEX_OP_ANDN fix Mikael Pettersson
2008-07-30 22:40 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox