Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sparc64: FUTEX_OP_ANDN fix

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>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Mikael Pettersson and committed by
David S. Miller
d72609e1 19fd3cab

+1 -1
+1 -1
arch/sparc/include/asm/futex_64.h
··· 59 59 __futex_cas_op("or\t%2, %4, %1", ret, oldval, uaddr, oparg); 60 60 break; 61 61 case FUTEX_OP_ANDN: 62 - __futex_cas_op("and\t%2, %4, %1", ret, oldval, uaddr, oparg); 62 + __futex_cas_op("andn\t%2, %4, %1", ret, oldval, uaddr, oparg); 63 63 break; 64 64 case FUTEX_OP_XOR: 65 65 __futex_cas_op("xor\t%2, %4, %1", ret, oldval, uaddr, oparg);