Skip to content

Commit

Permalink
Fix futex() to return EWOULDBLOCK if *uaddr != val
Browse files Browse the repository at this point in the history
futex() did not implement this, causing pthread_join() to wait forever if FUTEX_WAIT is called after FUTEX_WAKE.
  • Loading branch information
utshina committed Feb 19, 2018
1 parent 46437cb commit fcab6c6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ipc/futex.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,11 @@ do_private_futex(gaddr_t uaddr, int op, uint32_t val, gaddr_t timeout_ptr, gaddr
return do_private_futex_wake(uaddr, val, false, 0);
}
case LINUX_FUTEX_WAIT: {
uint32_t uval;
if (copy_from_user(&uval, uaddr, sizeof uval))
return -LINUX_EFAULT;
if (uval != val)
return -EWOULDBLOCK;
struct timespec ts;
if (timeout_ptr != 0) {
struct l_timespec timeout;
Expand Down

0 comments on commit fcab6c6

Please sign in to comment.