[golibs] Update dependencies

- golang.org/x/sys/unix: immaterial changes
- gvisor.dev/pkg/tcpip:
  + 326394b79 Fix listener close, client connect race

Bug: 67142
Change-Id: I9e7b18734276d166d50323e763c4df34e0dfa4b4
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/514804
Reviewed-by: Tamir Duberstein <tamird@google.com>
Commit-Queue: Tamir Duberstein <tamird@google.com>
diff --git a/third_party/golibs/go.mod b/third_party/golibs/go.mod
index f538e65..4ccf717 100644
--- a/third_party/golibs/go.mod
+++ b/third_party/golibs/go.mod
@@ -25,7 +25,7 @@
 	golang.org/x/mod v0.4.2 // indirect
 	golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1
 	golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
-	golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57
+	golang.org/x/sys v0.0.0-20210412220455-f1c623a9e750
 	golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect
 	gonum.org/v1/gonum v0.9.1
 	google.golang.org/api v0.44.0 // indirect
@@ -34,5 +34,5 @@
 	google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0
 	google.golang.org/protobuf v1.26.0
 	gopkg.in/yaml.v2 v2.4.0
-	gvisor.dev/gvisor v0.0.0-20210412205723-5dc99694d8de
+	gvisor.dev/gvisor v0.0.0-20210413080324-28f40ff47e9c
 )
diff --git a/third_party/golibs/go.sum b/third_party/golibs/go.sum
index 27fb186..49c6846 100644
--- a/third_party/golibs/go.sum
+++ b/third_party/golibs/go.sum
@@ -530,8 +530,9 @@
 golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57 h1:F5Gozwx4I1xtr/sr/8CFbb57iKi3297KFs0QDbGN60A=
 golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210412220455-f1c623a9e750 h1:ZBu6861dZq7xBnG1bn5SRU0vA8nx42at4+kP07FMTog=
+golang.org/x/sys v0.0.0-20210412220455-f1c623a9e750/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
 golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
 golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
@@ -744,8 +745,8 @@
 gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
 gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
 gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
-gvisor.dev/gvisor v0.0.0-20210412205723-5dc99694d8de h1:aEEjNgf32KBv0lwtob0++bv+MhzMWLG2WhJcLYoW+0A=
-gvisor.dev/gvisor v0.0.0-20210412205723-5dc99694d8de/go.mod h1:ucHEMlckp+S/YzKEpwwAyGBhAh807Wxq/8Erc6gFxCE=
+gvisor.dev/gvisor v0.0.0-20210413080324-28f40ff47e9c h1:HM2gfWvecZl/1Qt3fXaWfpH8lbQ1ba5ITQWQZnNAvlo=
+gvisor.dev/gvisor v0.0.0-20210413080324-28f40ff47e9c/go.mod h1:ucHEMlckp+S/YzKEpwwAyGBhAh807Wxq/8Erc6gFxCE=
 honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
diff --git a/third_party/golibs/vendor/golang.org/x/sys/unix/syscall_linux.go b/third_party/golibs/vendor/golang.org/x/sys/unix/syscall_linux.go
index 44ea96e..c61c963 100644
--- a/third_party/golibs/vendor/golang.org/x/sys/unix/syscall_linux.go
+++ b/third_party/golibs/vendor/golang.org/x/sys/unix/syscall_linux.go
@@ -106,6 +106,31 @@
 	return &value, err
 }
 
+type ifreqEthtool struct {
+	name [IFNAMSIZ]byte
+	data unsafe.Pointer
+}
+
+// IoctlGetEthtoolDrvinfo fetches ethtool driver information for the network
+// device specified by ifname.
+func IoctlGetEthtoolDrvinfo(fd int, ifname string) (*EthtoolDrvinfo, error) {
+	// Leave room for terminating NULL byte.
+	if len(ifname) >= IFNAMSIZ {
+		return nil, EINVAL
+	}
+
+	value := EthtoolDrvinfo{
+		Cmd: ETHTOOL_GDRVINFO,
+	}
+	ifreq := ifreqEthtool{
+		data: unsafe.Pointer(&value),
+	}
+	copy(ifreq.name[:], ifname)
+	err := ioctl(fd, SIOCETHTOOL, uintptr(unsafe.Pointer(&ifreq)))
+	runtime.KeepAlive(ifreq)
+	return &value, err
+}
+
 // IoctlGetWatchdogInfo fetches information about a watchdog device from the
 // Linux watchdog API. For more information, see:
 // https://www.kernel.org/doc/html/latest/watchdog/watchdog-api.html.
@@ -857,16 +882,19 @@
 	// CID and Port specify a context ID and port address for a VM socket.
 	// Guests have a unique CID, and hosts may have a well-known CID of:
 	//  - VMADDR_CID_HYPERVISOR: refers to the hypervisor process.
+	//  - VMADDR_CID_LOCAL: refers to local communication (loopback).
 	//  - VMADDR_CID_HOST: refers to other processes on the host.
-	CID  uint32
-	Port uint32
-	raw  RawSockaddrVM
+	CID   uint32
+	Port  uint32
+	Flags uint8
+	raw   RawSockaddrVM
 }
 
 func (sa *SockaddrVM) sockaddr() (unsafe.Pointer, _Socklen, error) {
 	sa.raw.Family = AF_VSOCK
 	sa.raw.Port = sa.Port
 	sa.raw.Cid = sa.CID
+	sa.raw.Flags = sa.Flags
 
 	return unsafe.Pointer(&sa.raw), SizeofSockaddrVM, nil
 }
@@ -1171,8 +1199,9 @@
 	case AF_VSOCK:
 		pp := (*RawSockaddrVM)(unsafe.Pointer(rsa))
 		sa := &SockaddrVM{
-			CID:  pp.Cid,
-			Port: pp.Port,
+			CID:   pp.Cid,
+			Port:  pp.Port,
+			Flags: pp.Flags,
 		}
 		return sa, nil
 	case AF_BLUETOOTH:
diff --git a/third_party/golibs/vendor/golang.org/x/sys/unix/ztypes_linux.go b/third_party/golibs/vendor/golang.org/x/sys/unix/ztypes_linux.go
index c769e73..3bfc6f7 100644
--- a/third_party/golibs/vendor/golang.org/x/sys/unix/ztypes_linux.go
+++ b/third_party/golibs/vendor/golang.org/x/sys/unix/ztypes_linux.go
@@ -3698,6 +3698,21 @@
 	ETHTOOL_A_TUNNEL_INFO_MAX                 = 0x2
 )
 
+type EthtoolDrvinfo struct {
+	Cmd          uint32
+	Driver       [32]byte
+	Version      [32]byte
+	Fw_version   [32]byte
+	Bus_info     [32]byte
+	Erom_version [32]byte
+	Reserved2    [12]byte
+	N_priv_flags uint32
+	N_stats      uint32
+	Testinfo_len uint32
+	Eedump_len   uint32
+	Regdump_len  uint32
+}
+
 type (
 	HIDRawReportDescriptor struct {
 		Size  uint32
diff --git a/third_party/golibs/vendor/gvisor.dev/gvisor/pkg/tcpip/transport/tcp/accept.go b/third_party/golibs/vendor/gvisor.dev/gvisor/pkg/tcpip/transport/tcp/accept.go
index 7acc7e7..63c46b1 100644
--- a/third_party/golibs/vendor/gvisor.dev/gvisor/pkg/tcpip/transport/tcp/accept.go
+++ b/third_party/golibs/vendor/gvisor.dev/gvisor/pkg/tcpip/transport/tcp/accept.go
@@ -511,22 +511,22 @@
 
 func (e *endpoint) synRcvdBacklogFull() bool {
 	e.acceptMu.Lock()
-	backlog := e.accepted.cap
+	acceptedCap := e.accepted.cap
 	e.acceptMu.Unlock()
-	// The allocated accepted channel size would always be one greater than the
+	// The capacity of the accepted queue would always be one greater than the
 	// listen backlog. But, the SYNRCVD connections count is always checked
 	// against the listen backlog value for Linux parity reason.
 	// https://github.com/torvalds/linux/blob/7acac4b3196/include/net/inet_connection_sock.h#L280
 	//
 	// We maintain an equality check here as the synRcvdCount is incremented
 	// and compared only from a single listener context and the capacity of
-	// the accepted channel can only increase by a new listen call.
-	return int(atomic.LoadInt32(&e.synRcvdCount)) == backlog-1
+	// the accepted queue can only increase by a new listen call.
+	return int(atomic.LoadInt32(&e.synRcvdCount)) == acceptedCap-1
 }
 
 func (e *endpoint) acceptQueueIsFull() bool {
 	e.acceptMu.Lock()
-	full := e.accepted.endpoints.Len() == e.accepted.cap
+	full := e.accepted != (accepted{}) && e.accepted.endpoints.Len() == e.accepted.cap
 	e.acceptMu.Unlock()
 	return full
 }
diff --git a/third_party/golibs/vendor/gvisor.dev/gvisor/pkg/tcpip/transport/tcp/endpoint.go b/third_party/golibs/vendor/gvisor.dev/gvisor/pkg/tcpip/transport/tcp/endpoint.go
index 1060a0a9..9afd2bb 100644
--- a/third_party/golibs/vendor/gvisor.dev/gvisor/pkg/tcpip/transport/tcp/endpoint.go
+++ b/third_party/golibs/vendor/gvisor.dev/gvisor/pkg/tcpip/transport/tcp/endpoint.go
@@ -962,7 +962,7 @@
 		result = mask
 
 	case StateListen:
-		// Check if there's anything in the accepted channel.
+		// Check if there's anything in the accepted queue.
 		if (mask & waiter.ReadableEvents) != 0 {
 			e.acceptMu.Lock()
 			if e.accepted.endpoints.Len() != 0 {
diff --git a/third_party/golibs/vendor/gvisor.dev/gvisor/pkg/tcpip/transport/tcp/endpoint_state.go b/third_party/golibs/vendor/gvisor.dev/gvisor/pkg/tcpip/transport/tcp/endpoint_state.go
index f51b3ad..5907754 100644
--- a/third_party/golibs/vendor/gvisor.dev/gvisor/pkg/tcpip/transport/tcp/endpoint_state.go
+++ b/third_party/golibs/vendor/gvisor.dev/gvisor/pkg/tcpip/transport/tcp/endpoint_state.go
@@ -67,7 +67,7 @@
 			e.mu.Lock()
 		}
 		if !e.workerRunning {
-			// The endpoint must be in acceptedChan or has been just
+			// The endpoint must be in the accepted queue or has been just
 			// disconnected and closed.
 			break
 		}
diff --git a/third_party/golibs/vendor/modules.txt b/third_party/golibs/vendor/modules.txt
index 3bd9656..b072be9 100644
--- a/third_party/golibs/vendor/modules.txt
+++ b/third_party/golibs/vendor/modules.txt
@@ -163,7 +163,7 @@
 # golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
 ## explicit
 golang.org/x/sync/errgroup
-# golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57
+# golang.org/x/sys v0.0.0-20210412220455-f1c623a9e750
 ## explicit
 golang.org/x/sys/cpu
 golang.org/x/sys/execabs
@@ -332,7 +332,7 @@
 # gopkg.in/yaml.v2 v2.4.0
 ## explicit
 gopkg.in/yaml.v2
-# gvisor.dev/gvisor v0.0.0-20210412205723-5dc99694d8de
+# gvisor.dev/gvisor v0.0.0-20210413080324-28f40ff47e9c
 ## explicit
 gvisor.dev/gvisor/pkg/gohacks
 gvisor.dev/gvisor/pkg/goid