Commit 9b7e30ab authored by Aurelien Jarno's avatar Aurelien Jarno Committed by Rich Felker

sh: fix futex FUTEX_OP_SET op on userspace addresses

Commit 00b73d8d ("sh: add working futex atomic ops on userspace
addresses for smp") changed the futex_atomic_op_inuser function to
use a loop. In case of the FUTEX_OP_SET op with a userspace address
containing a value different of 0, this loop is an endless loop.

Fix that by loading the value of oldval from the userspace before doing
the cmpxchg op, also for the FUTEX_OP_SET case.
Signed-off-by: default avatarAurelien Jarno <aurelien@aurel32.net>
Signed-off-by: default avatarRich Felker <dalias@libc.org>
parent 0adb3285
...@@ -37,9 +37,6 @@ static inline int arch_futex_atomic_op_inuser(int op, u32 oparg, int *oval, ...@@ -37,9 +37,6 @@ static inline int arch_futex_atomic_op_inuser(int op, u32 oparg, int *oval,
pagefault_disable(); pagefault_disable();
do { do {
if (op == FUTEX_OP_SET)
ret = oldval = 0;
else
ret = get_user(oldval, uaddr); ret = get_user(oldval, uaddr);
if (ret) break; if (ret) break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment