diff options
author | gVisor bot <gvisor-bot@google.com> | 2020-06-10 20:29:38 +0000 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2020-06-10 20:29:38 +0000 |
commit | 57b351db8d31579cc19b5075ed70aadfe4ecdc9c (patch) | |
tree | af31f6917e93ffd82ca12df88b3f1d622e455e3f /pkg/sentry/socket/unix | |
parent | 9d099c6a4f4e91f3b08396958496c92912d19c34 (diff) | |
parent | a5a4f804879f8d1b5e6de6005aef6d3e14e7dca2 (diff) |
Merge release-20200522.0-119-ga5a4f8048 (automated)
Diffstat (limited to 'pkg/sentry/socket/unix')
-rw-r--r-- | pkg/sentry/socket/unix/unix.go | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/pkg/sentry/socket/unix/unix.go b/pkg/sentry/socket/unix/unix.go index c4c9db81b..4bb2b6ff4 100644 --- a/pkg/sentry/socket/unix/unix.go +++ b/pkg/sentry/socket/unix/unix.go @@ -459,15 +459,25 @@ func (s *socketOpsCommon) SendMsg(t *kernel.Task, src usermem.IOSequence, to []b To: nil, } if len(to) > 0 { - ep, err := extractEndpoint(t, to) - if err != nil { - return 0, err - } - defer ep.Release() - w.To = ep + switch s.stype { + case linux.SOCK_SEQPACKET: + to = nil + case linux.SOCK_STREAM: + if s.State() == linux.SS_CONNECTED { + return 0, syserr.ErrAlreadyConnected + } + return 0, syserr.ErrNotSupported + default: + ep, err := extractEndpoint(t, to) + if err != nil { + return 0, err + } + defer ep.Release() + w.To = ep - if ep.Passcred() && w.Control.Credentials == nil { - w.Control.Credentials = control.MakeCreds(t) + if ep.Passcred() && w.Control.Credentials == nil { + w.Control.Credentials = control.MakeCreds(t) + } } } |