diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2020-03-20 05:23:48 +0300 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2020-03-28 06:58:55 +0300 |
commit | f5544ba712afd1b01dd856c7eecfb5d30beaf920 (patch) | |
tree | 3e113b81de08219cf15ba25a597b8f7cb6a5fd13 /arch/x86/include/asm/futex.h | |
parent | a251b2d513ea4116ddb5487610e4b4048c7aa397 (diff) | |
download | linux-f5544ba712afd1b01dd856c7eecfb5d30beaf920.tar.xz |
x86: get rid of user_atomic_cmpxchg_inatomic()
Only one user left; the thing had been made polymorphic back in 2013
for the sake of MPX. No point keeping it now that MPX is gone.
Convert futex_atomic_cmpxchg_inatomic() to user_access_{begin,end}()
while we are at it.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'arch/x86/include/asm/futex.h')
-rw-r--r-- | arch/x86/include/asm/futex.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/arch/x86/include/asm/futex.h b/arch/x86/include/asm/futex.h index 5ff7626a333d..f9c00110a69a 100644 --- a/arch/x86/include/asm/futex.h +++ b/arch/x86/include/asm/futex.h @@ -90,7 +90,25 @@ Efault: static inline int futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr, u32 oldval, u32 newval) { - return user_atomic_cmpxchg_inatomic(uval, uaddr, oldval, newval); + int ret = 0; + + if (!user_access_begin(uaddr, sizeof(u32))) + return -EFAULT; + asm volatile("\n" + "1:\t" LOCK_PREFIX "cmpxchgl %4, %2\n" + "2:\n" + "\t.section .fixup, \"ax\"\n" + "3:\tmov %3, %0\n" + "\tjmp 2b\n" + "\t.previous\n" + _ASM_EXTABLE_UA(1b, 3b) + : "+r" (ret), "=a" (oldval), "+m" (*uaddr) + : "i" (-EFAULT), "r" (newval), "1" (oldval) + : "memory" + ); + user_access_end(); + *uval = oldval; + return ret; } #endif |