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>] [day] [month] [year] [list]
Message-ID: <158539357755.28353.1367590741418303273.tip-bot2@tip-bot2>
Date:   Sat, 28 Mar 2020 11:06:17 -0000
From:   "tip-bot2 for Al Viro" <tip-bot2@...utronix.de>
To:     linux-tip-commits@...r.kernel.org
Cc:     Al Viro <viro@...iv.linux.org.uk>, x86 <x86@...nel.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: [tip: locking/core] x86: don't reload after cmpxchg in
 unsafe_atomic_op2() loop

The following commit has been merged into the locking/core branch of tip:

Commit-ID:     8aef36dacb3a932cb77da8bb7eb21a154babd0b8
Gitweb:        https://git.kernel.org/tip/8aef36dacb3a932cb77da8bb7eb21a154babd0b8
Author:        Al Viro <viro@...iv.linux.org.uk>
AuthorDate:    Thu, 26 Mar 2020 17:34:40 -04:00
Committer:     Al Viro <viro@...iv.linux.org.uk>
CommitterDate: Fri, 27 Mar 2020 23:58:54 -04:00

x86: don't reload after cmpxchg in unsafe_atomic_op2() loop

lock cmpxchg leaves the current value in eax; no need to reload it.

Signed-off-by: Al Viro <viro@...iv.linux.org.uk>
---
 arch/x86/include/asm/futex.h | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/x86/include/asm/futex.h b/arch/x86/include/asm/futex.h
index 53c07ab..5ff7626 100644
--- a/arch/x86/include/asm/futex.h
+++ b/arch/x86/include/asm/futex.h
@@ -34,17 +34,17 @@ do {								\
 do {								\
 	int oldval = 0, ret, tem;				\
 	asm volatile("1:\tmovl	%2, %0\n"			\
-		     "\tmovl\t%0, %3\n"				\
+		     "2:\tmovl\t%0, %3\n"			\
 		     "\t" insn "\n"				\
-		     "2:\t" LOCK_PREFIX "cmpxchgl %3, %2\n"	\
-		     "\tjnz\t1b\n"				\
-		     "3:\n"					\
+		     "3:\t" LOCK_PREFIX "cmpxchgl %3, %2\n"	\
+		     "\tjnz\t2b\n"				\
+		     "4:\n"					\
 		     "\t.section .fixup,\"ax\"\n"		\
-		     "4:\tmov\t%5, %1\n"			\
-		     "\tjmp\t3b\n"				\
+		     "5:\tmov\t%5, %1\n"			\
+		     "\tjmp\t4b\n"				\
 		     "\t.previous\n"				\
-		     _ASM_EXTABLE_UA(1b, 4b)			\
-		     _ASM_EXTABLE_UA(2b, 4b)			\
+		     _ASM_EXTABLE_UA(1b, 5b)			\
+		     _ASM_EXTABLE_UA(3b, 5b)			\
 		     : "=&a" (oldval), "=&r" (ret),		\
 		       "+m" (*uaddr), "=&r" (tem)		\
 		     : "r" (oparg), "i" (-EFAULT), "1" (0));	\

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ