summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/syscalls/linux/sys_futex.go
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2019-12-20 01:43:31 +0000
committergVisor bot <gvisor-bot@google.com>2019-12-20 01:43:31 +0000
commit99cfc711c6999d2c47c2498e8d9a10b4b28e7fcd (patch)
tree1a57580544df80a4166f70aa88c8ff8ce268cdf5 /pkg/sentry/syscalls/linux/sys_futex.go
parent74f3ba6a6907305e1c6fb416a97a5a3bd5cb9bb3 (diff)
parent29955a4797e8264f75886a989dbc81b2b5443f4c (diff)
Merge release-20191213.0-36-g29955a4 (automated)
Diffstat (limited to 'pkg/sentry/syscalls/linux/sys_futex.go')
-rw-r--r--pkg/sentry/syscalls/linux/sys_futex.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/sentry/syscalls/linux/sys_futex.go b/pkg/sentry/syscalls/linux/sys_futex.go
index b9bd25464..bde17a767 100644
--- a/pkg/sentry/syscalls/linux/sys_futex.go
+++ b/pkg/sentry/syscalls/linux/sys_futex.go
@@ -226,6 +226,11 @@ func Futex(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Syscall
if mask == 0 {
return 0, nil, syserror.EINVAL
}
+ if val <= 0 {
+ // The Linux kernel wakes one waiter even if val is
+ // non-positive.
+ val = 1
+ }
n, err := t.Futex().Wake(t, addr, private, mask, val)
return uintptr(n), nil, err
@@ -242,6 +247,11 @@ func Futex(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Syscall
case linux.FUTEX_WAKE_OP:
op := uint32(val3)
+ if val <= 0 {
+ // The Linux kernel wakes one waiter even if val is
+ // non-positive.
+ val = 1
+ }
n, err := t.Futex().WakeOp(t, addr, naddr, private, val, nreq, op)
return uintptr(n), nil, err