summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/syscalls
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/sentry/syscalls')
-rw-r--r--pkg/sentry/syscalls/linux/sys_read.go2
-rwxr-xr-xpkg/sentry/syscalls/linux/vfs2/sys_read.go16
2 files changed, 9 insertions, 9 deletions
diff --git a/pkg/sentry/syscalls/linux/sys_read.go b/pkg/sentry/syscalls/linux/sys_read.go
index f9f594190..227692f06 100644
--- a/pkg/sentry/syscalls/linux/sys_read.go
+++ b/pkg/sentry/syscalls/linux/sys_read.go
@@ -29,7 +29,7 @@ import (
)
const (
- // EventMaskRead contains events that can be triggerd on reads.
+ // EventMaskRead contains events that can be triggered on reads.
EventMaskRead = waiter.EventIn | waiter.EventHUp | waiter.EventErr
)
diff --git a/pkg/sentry/syscalls/linux/vfs2/sys_read.go b/pkg/sentry/syscalls/linux/vfs2/sys_read.go
index b9fb58464..7667524c7 100755
--- a/pkg/sentry/syscalls/linux/vfs2/sys_read.go
+++ b/pkg/sentry/syscalls/linux/vfs2/sys_read.go
@@ -24,6 +24,11 @@ import (
"gvisor.dev/gvisor/pkg/waiter"
)
+const (
+ // EventMaskRead contains events that can be triggered on reads.
+ EventMaskRead = waiter.EventIn | waiter.EventHUp | waiter.EventErr
+)
+
// Read implements linux syscall read(2). Note that we try to get a buffer that
// is exactly the size requested because some applications like qemu expect
// they can do large reads all at once. Bug for bug. Same for other read
@@ -39,11 +44,6 @@ func Read(t *kernel.Task, args arch.SyscallArguments) (uintptr, *kernel.SyscallC
}
defer file.DecRef()
- // Check that the file is readable.
- if !file.IsReadable() {
- return 0, nil, syserror.EBADF
- }
-
// Check that the size is legitimate.
si := int(size)
if si < 0 {
@@ -70,8 +70,8 @@ func read(t *kernel.Task, file *vfs.FileDescription, dst usermem.IOSequence, opt
}
// Register for notifications.
- _, ch := waiter.NewChannelEntry(nil)
- // file.EventRegister(&w, EventMaskRead)
+ w, ch := waiter.NewChannelEntry(nil)
+ file.EventRegister(&w, EventMaskRead)
total := n
for {
@@ -89,7 +89,7 @@ func read(t *kernel.Task, file *vfs.FileDescription, dst usermem.IOSequence, opt
break
}
}
- //file.EventUnregister(&w)
+ file.EventUnregister(&w)
return total, err
}