summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBrian Geffon <bgeffon@google.com>2018-06-07 15:09:27 -0700
committerShentubot <shentubot@google.com>2018-06-07 15:10:15 -0700
commit5c37097e34a513845d77bb8b7240f0074aa1c1e9 (patch)
tree9e39d313c22f76c6e1207f1910ad3856a3de1a87
parent7e9893eeb500ab56dcab80471300df50c12288ae (diff)
rpcinet should not block in read(2) rpcs.
PiperOrigin-RevId: 199703609 Change-Id: I8153b0396b22a230a68d4b69c46652a5545f7630
-rw-r--r--pkg/sentry/socket/rpcinet/socket.go23
1 files changed, 1 insertions, 22 deletions
diff --git a/pkg/sentry/socket/rpcinet/socket.go b/pkg/sentry/socket/rpcinet/socket.go
index 29546b683..69cf604b7 100644
--- a/pkg/sentry/socket/rpcinet/socket.go
+++ b/pkg/sentry/socket/rpcinet/socket.go
@@ -145,29 +145,8 @@ func (s *socketOperations) Read(ctx context.Context, _ *fs.File, dst usermem.IOS
n, e := dst.CopyOut(ctx, res.Data)
return int64(n), e
}
- if se != syserr.ErrWouldBlock {
- return 0, se.ToError()
- }
-
- // We'll have to block. Register for notifications and read again when ready.
- e, ch := waiter.NewChannelEntry(nil)
- s.EventRegister(&e, waiter.EventIn)
- defer s.EventUnregister(&e)
- for {
- res, se := rpcRead(ctx.(*kernel.Task), req)
- if se == nil {
- n, e := dst.CopyOut(ctx, res.Data)
- return int64(n), e
- }
- if se != syserr.ErrWouldBlock {
- return 0, se.ToError()
- }
-
- if err := ctx.(*kernel.Task).Block(ch); err != nil {
- return 0, err
- }
- }
+ return 0, se.ToError()
}
func rpcWrite(t *kernel.Task, req *pb.SyscallRequest_Write) (uint32, *syserr.Error) {