Commit Graph

7 Commits

Author SHA1 Message Date
gVisor bot d22f0534c0 Merge pull request #736 from tanjianfeng:fix-unix
PiperOrigin-RevId: 275114157
2019-10-16 14:41:43 -07:00
Jianfeng Tan 2c3e2ed2bf unix: return ECONNRESET if peer closed with data not read
For SOCK_STREAM type unix socket, we shall return ECONNRESET if peer is
closed with data not read.

We explictly set a flag when closing one end, to differentiate from
just shutdown (where zero shall be returned).

Fixes: #735

Signed-off-by: Jianfeng Tan <henry.tjf@antfin.com>
2019-08-22 15:25:38 +00:00
Jianfeng Tan 96f78e2466 unix: return zero if peer is closed
Previously, recvmsg() on a unix stream socket with its peer closed will
never return, with goroutine call trace like this:

  ...
  2  in gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).block
     at pkg/sentry/kernel/task_block.go:124
  3  in gvisor.dev/gvisor/pkg/sentry/kernel.(*Task).BlockWithDeadline
     at pkg/sentry/kernel/task_block.go:69
  4  in gvisor.dev/gvisor/pkg/sentry/socket/unix.(*SocketOperations).RecvMsg
     at pkg/sentry/socket/unix/unix.go:612
  5  in gvisor.dev/gvisor/pkg/sentry/syscalls/linux.recvFrom
     at pkg/sentry/syscalls/linux/sys_socket.go:885
  6  in gvisor.dev/gvisor/pkg/sentry/syscalls/linux.RecvFrom
     at pkg/sentry/syscalls/linux/sys_socket.go:910
  ...

The issue is caused by that ErrClosedForReceive returned by
unix/transport.queue is turned into nil in
unix.(*EndpointReader).ReadToBlocks():

  err.ToError()

As a result, in unix.(*SocketOperations).RecvMsg():

  n == 0 and err == nil

We shall differentiate it from another case - no data to read where
ErrWouldBlock shall be returned; and return 0 immediately.

Fixes: #734

Reported-by: chenglang.hy <chenglang.hy@antfin.com>
Signed-off-by: Jianfeng Tan <henry.tjf@antfin.com>
2019-08-22 15:25:38 +00:00
Michael Pratt 4d52a55201 Change copyright notice to "The gVisor Authors"
Based on the guidelines at
https://opensource.google.com/docs/releasing/authors/.

1. $ rg -l "Google LLC" | xargs sed -i 's/Google LLC.*/The gVisor Authors./'
2. Manual fixup of "Google Inc" references.
3. Add AUTHORS file. Authors may request to be added to this file.
4. Point netstack AUTHORS to gVisor AUTHORS. Drop CONTRIBUTORS.

Fixes #209

PiperOrigin-RevId: 245823212
Change-Id: I64530b24ad021a7d683137459cafc510f5ee1de9
2019-04-29 14:26:23 -07:00
Tamir Duberstein ac8fca1ef4 Appease googletest deprecation
PiperOrigin-RevId: 245788366
Change-Id: I17bbecf8493132dbe95564c34c45b838194bfabb
2019-04-29 11:34:16 -07:00
Jamie Liu 876b241fac Remove O_CLOEXEC from socket test configurations where irrelevant.
The implementation of O_CLOEXEC is orthogonal to every property tested
by these tests; removing it significantly reduces the number of
redundant tests we run.

Also remove no-op calls to VecCat (calls with a single argument).

PiperOrigin-RevId: 230959537
Change-Id: I83fe7db24e481ef67ca1f1992228af423f640b5c
2019-01-25 13:35:32 -08:00
Brian Geffon d3bc79bc84 Open source system call tests.
PiperOrigin-RevId: 224886231
Change-Id: I0fccb4d994601739d8b16b1d4e6b31f40297fb22
2018-12-10 14:42:34 -08:00