diff options
Diffstat (limited to 'pkg/sentry/fs')
-rw-r--r-- | pkg/sentry/fs/gofer/BUILD | 1 | ||||
-rw-r--r-- | pkg/sentry/fs/gofer/socket.go | 3 | ||||
-rw-r--r-- | pkg/sentry/fs/host/BUILD | 1 | ||||
-rw-r--r-- | pkg/sentry/fs/host/socket.go | 4 | ||||
-rw-r--r-- | pkg/sentry/fs/host/socket_test.go | 13 |
5 files changed, 11 insertions, 11 deletions
diff --git a/pkg/sentry/fs/gofer/BUILD b/pkg/sentry/fs/gofer/BUILD index ee2f287d9..73372a829 100644 --- a/pkg/sentry/fs/gofer/BUILD +++ b/pkg/sentry/fs/gofer/BUILD @@ -49,6 +49,7 @@ go_library( "//pkg/sentry/socket/unix/transport", "//pkg/sync", "//pkg/syserr", + "//pkg/tcpip", "//pkg/unet", "//pkg/usermem", "//pkg/waiter", diff --git a/pkg/sentry/fs/gofer/socket.go b/pkg/sentry/fs/gofer/socket.go index 1fd8a0910..17932bf1a 100644 --- a/pkg/sentry/fs/gofer/socket.go +++ b/pkg/sentry/fs/gofer/socket.go @@ -23,6 +23,7 @@ import ( "gvisor.dev/gvisor/pkg/sentry/fs/host" "gvisor.dev/gvisor/pkg/sentry/socket/unix/transport" "gvisor.dev/gvisor/pkg/syserr" + "gvisor.dev/gvisor/pkg/tcpip" "gvisor.dev/gvisor/pkg/waiter" ) @@ -95,7 +96,7 @@ func (e *endpoint) BidirectionalConnect(ctx context.Context, ce transport.Connec } if ce.Listening() { ce.Unlock() - return syserr.ErrInvalidEndpointState + return tcpip.SyserrInvalidEndpointState } hostFile, err := e.file.Connect(cf) diff --git a/pkg/sentry/fs/host/BUILD b/pkg/sentry/fs/host/BUILD index 921612e9c..78e5cef9d 100644 --- a/pkg/sentry/fs/host/BUILD +++ b/pkg/sentry/fs/host/BUILD @@ -77,7 +77,6 @@ go_test( "//pkg/sentry/kernel/time", "//pkg/sentry/socket", "//pkg/sentry/socket/unix/transport", - "//pkg/syserr", "//pkg/tcpip", "//pkg/usermem", "//pkg/waiter", diff --git a/pkg/sentry/fs/host/socket.go b/pkg/sentry/fs/host/socket.go index 54c421775..17ee77af4 100644 --- a/pkg/sentry/fs/host/socket.go +++ b/pkg/sentry/fs/host/socket.go @@ -82,7 +82,7 @@ func (c *ConnectedEndpoint) init() *syserr.Error { if family != unix.AF_UNIX { // We only allow Unix sockets. - return syserr.ErrInvalidEndpointState + return tcpip.SyserrInvalidEndpointState } stype, err := unix.GetsockoptInt(c.file.FD(), unix.SOL_SOCKET, unix.SO_TYPE) @@ -200,7 +200,7 @@ func (c *ConnectedEndpoint) Send(ctx context.Context, data [][]byte, controlMess defer c.mu.RUnlock() if !controlMessages.Empty() { - return 0, false, syserr.ErrInvalidEndpointState + return 0, false, tcpip.SyserrInvalidEndpointState } // Since stream sockets don't preserve message boundaries, we can write diff --git a/pkg/sentry/fs/host/socket_test.go b/pkg/sentry/fs/host/socket_test.go index f7014b6b1..bf7fc1a81 100644 --- a/pkg/sentry/fs/host/socket_test.go +++ b/pkg/sentry/fs/host/socket_test.go @@ -25,7 +25,6 @@ import ( ktime "gvisor.dev/gvisor/pkg/sentry/kernel/time" "gvisor.dev/gvisor/pkg/sentry/socket" "gvisor.dev/gvisor/pkg/sentry/socket/unix/transport" - "gvisor.dev/gvisor/pkg/syserr" "gvisor.dev/gvisor/pkg/tcpip" "gvisor.dev/gvisor/pkg/usermem" "gvisor.dev/gvisor/pkg/waiter" @@ -178,11 +177,11 @@ func TestListen(t *testing.T) { socket2 := sfile2.FileOperations.(socket.Socket) // Socketpairs can not be listened to. - if err := socket1.Listen(nil, 64); err != syserr.ErrInvalidEndpointState { - t.Fatalf("socket1.Listen(nil, 64) => %v, want syserr.ErrInvalidEndpointState", err) + if err := socket1.Listen(nil, 64); err != tcpip.SyserrInvalidEndpointState { + t.Fatalf("socket1.Listen(nil, 64) => %v, want tcpip.SyserrInvalidEndpointState", err) } - if err := socket2.Listen(nil, 64); err != syserr.ErrInvalidEndpointState { - t.Fatalf("socket2.Listen(nil, 64) => %v, want syserr.ErrInvalidEndpointState", err) + if err := socket2.Listen(nil, 64); err != tcpip.SyserrInvalidEndpointState { + t.Fatalf("socket2.Listen(nil, 64) => %v, want tcpip.SyserrInvalidEndpointState", err) } // Create a Unix socket, do not bind it. @@ -198,8 +197,8 @@ func TestListen(t *testing.T) { socket3 := sfile3.FileOperations.(socket.Socket) // This socket is not bound so we can't listen on it. - if err := socket3.Listen(nil, 64); err != syserr.ErrInvalidEndpointState { - t.Fatalf("socket3.Listen(nil, 64) => %v, want syserr.ErrInvalidEndpointState", err) + if err := socket3.Listen(nil, 64); err != tcpip.SyserrInvalidEndpointState { + t.Fatalf("socket3.Listen(nil, 64) => %v, want tcpip.SyserrInvalidEndpointState", err) } } |