summaryrefslogtreecommitdiffhomepage
path: root/pkg
diff options
context:
space:
mode:
authorIan Gudger <igudger@google.com>2018-05-01 08:06:11 -0700
committerShentubot <shentubot@google.com>2018-05-01 08:07:06 -0700
commitb701ee221434572881b9b3b0164d5a5b54714fa9 (patch)
treec2dc97c792233cdc8020f529157eeee5e23282b8 /pkg
parent8a17bd183e0f7528c03c5445de4d74bf72e068f1 (diff)
Fix SO_RCVTIMEOUT for recvmsg
PiperOrigin-RevId: 194938091 Change-Id: Id17f26df13a915ec0c388aad3198207ea1c28d53
Diffstat (limited to 'pkg')
-rw-r--r--pkg/sentry/syscalls/linux/sys_socket.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/pkg/sentry/syscalls/linux/sys_socket.go b/pkg/sentry/syscalls/linux/sys_socket.go
index 3797c0a5d..70c618398 100644
--- a/pkg/sentry/syscalls/linux/sys_socket.go
+++ b/pkg/sentry/syscalls/linux/sys_socket.go
@@ -610,7 +610,14 @@ func RecvMsg(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.Sysca
flags |= linux.MSG_DONTWAIT
}
- n, err := recvSingleMsg(t, s, msgPtr, flags, false, ktime.Time{})
+ var haveDeadline bool
+ var deadline ktime.Time
+ if dl := s.RecvTimeout(); dl != 0 {
+ deadline = t.Kernel().MonotonicClock().Now().Add(time.Duration(dl) * time.Nanosecond)
+ haveDeadline = true
+ }
+
+ n, err := recvSingleMsg(t, s, msgPtr, flags, haveDeadline, deadline)
return n, nil, err
}