summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry
diff options
context:
space:
mode:
authorZach Koopmans <zkoopmans@google.com>2019-01-10 09:43:43 -0800
committerShentubot <shentubot@google.com>2019-01-10 09:44:45 -0800
commit7f8de3bf92decbd745a4bc4e8aebf1ba1159ed4b (patch)
treec667c9bd31a29cec2ddce86ef0b6128fee2defc2 /pkg/sentry
parent9270d940eb1a6e31587c34f4644189f3b2c002e1 (diff)
Fixing select call to not enforce RLIMIT_NOFILE.
Removing check to RLIMIT_NOFILE in select call. Adding unit test to select suite to document behavior. Moving setrlimit class from mlock to a util file for reuse. Fixing flaky test based on comments from Jamie. PiperOrigin-RevId: 228726131 Change-Id: Ie9dbe970bbf835ba2cca6e17eec7c2ee6fadf459
Diffstat (limited to 'pkg/sentry')
-rw-r--r--pkg/sentry/syscalls/linux/sys_poll.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/pkg/sentry/syscalls/linux/sys_poll.go b/pkg/sentry/syscalls/linux/sys_poll.go
index bf0958435..0cf6aad7f 100644
--- a/pkg/sentry/syscalls/linux/sys_poll.go
+++ b/pkg/sentry/syscalls/linux/sys_poll.go
@@ -82,7 +82,7 @@ func doPoll(t *kernel.Task, pfdAddr usermem.Addr, nfds uint, timeout time.Durati
}
func doSelect(t *kernel.Task, nfds int, readFDs, writeFDs, exceptFDs usermem.Addr, timeout time.Duration) (uintptr, error) {
- if nfds < 0 || uint64(nfds) > t.ThreadGroup().Limits().GetCapped(limits.NumberOfFiles, fileCap) {
+ if nfds < 0 || nfds > fileCap {
return 0, syserror.EINVAL
}
@@ -90,6 +90,7 @@ func doSelect(t *kernel.Task, nfds int, readFDs, writeFDs, exceptFDs usermem.Add
//
// N.B. This only works on little-endian architectures.
byteCount := (nfds + 7) / 8
+
bitsInLastPartialByte := uint(nfds % 8)
r := make([]byte, byteCount)
w := make([]byte, byteCount)