From 4b9cb381572e0f61f2a6c2259094548172900e0d Mon Sep 17 00:00:00 2001 From: Andrei Vagin Date: Tue, 28 May 2019 22:28:01 -0700 Subject: gvisor: socket() returns EPROTONOSUPPORT if protocol is not supported PiperOrigin-RevId: 250426407 --- pkg/sentry/socket/unix/unix.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'pkg/sentry/socket/unix') diff --git a/pkg/sentry/socket/unix/unix.go b/pkg/sentry/socket/unix/unix.go index 931056d51..1414be0c6 100644 --- a/pkg/sentry/socket/unix/unix.go +++ b/pkg/sentry/socket/unix/unix.go @@ -598,8 +598,8 @@ type provider struct{} // Socket returns a new unix domain socket. func (*provider) Socket(t *kernel.Task, stype transport.SockType, protocol int) (*fs.File, *syserr.Error) { // Check arguments. - if protocol != 0 { - return nil, syserr.ErrInvalidArgument + if protocol != 0 && protocol != linux.AF_UNIX /* PF_UNIX */ { + return nil, syserr.ErrProtocolNotSupported } // Create the endpoint and socket. @@ -624,8 +624,8 @@ func (*provider) Socket(t *kernel.Task, stype transport.SockType, protocol int) // Pair creates a new pair of AF_UNIX connected sockets. func (*provider) Pair(t *kernel.Task, stype transport.SockType, protocol int) (*fs.File, *fs.File, *syserr.Error) { // Check arguments. - if protocol != 0 { - return nil, nil, syserr.ErrInvalidArgument + if protocol != 0 && protocol != linux.AF_UNIX /* PF_UNIX */ { + return nil, nil, syserr.ErrProtocolNotSupported } var isPacket bool -- cgit v1.2.3