]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
s390/futex: Fix FUTEX_OP_ANDN implementation
authorHeiko Carstens <hca@linux.ibm.com>
Tue, 7 Jan 2025 10:28:58 +0000 (11:28 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 11:50:23 +0000 (12:50 +0100)
commit 26701574cee6777f867f89b4a5c667817e1ee0dd upstream.

The futex operation FUTEX_OP_ANDN is supposed to implement

*(int *)UADDR2 &= ~OPARG;

The s390 implementation just implements an AND instead of ANDN.
Add the missing bitwise not operation to oparg to fix this.

This is broken since nearly 19 years, so it looks like user space is
not making use of this operation.

Fixes: 3363fbdd6fb4 ("[PATCH] s390: futex atomic operations")
Cc: stable@vger.kernel.org
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Acked-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/s390/include/asm/futex.h

index bf15767b729f9f56dac9e8f86ce0b660d66f6a0f..002e0e6a9b2baf8993903acc6e19083c0f9d8137 100644 (file)
@@ -43,7 +43,7 @@ static inline int arch_futex_atomic_op_inuser(int op, int oparg, int *oval,
                break;
        case FUTEX_OP_ANDN:
                __futex_atomic_op("lr %2,%1\nnr %2,%5\n",
-                                 ret, oldval, newval, uaddr, oparg);
+                                 ret, oldval, newval, uaddr, ~oparg);
                break;
        case FUTEX_OP_XOR:
                __futex_atomic_op("lr %2,%1\nxr %2,%5\n",