You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TAP/TUN fd's are not sockets and using the WritePackets calls results
in errors as it always defaults to using SendMMsg which is not supported
for tap/tun device fds.
This CL changes WritePackets to gracefully degrade to using writev instead
of sendmmsg if the underlying fd is not a socket.
Fixes#7125
RELNOTES[servinf]: n/a. Does not impact serverless as tun/tap is not used by sentry.
PiperOrigin-RevId: 425992492
Description
Since commit e511fc9 removed the
WritePacket
method from tcpip/link/fdbased package, this error may occur under some certain circumstances.e.g. When we use tcpip/link/tun to open a TUN device:
Then pass the TUN fd as a fdbased.Option and add the endpoint to stack:
The
WritePackets
method would be called to write back packets:gvisor/pkg/tcpip/link/fdbased/endpoint.go
Line 671 in e511fc9
Then the
sendBatch
:gvisor/pkg/tcpip/link/fdbased/endpoint.go
Line 689 in e511fc9
However, in the the
sendBatch
, theelse
would be hit and call therawfile.NonBlockingSendMMsg(batchFD, mmsgHdrs)
:gvisor/pkg/tcpip/link/fdbased/endpoint.go
Lines 637 to 657 in e511fc9
So the issue happens here, the
SENDMMSG
syscall is used on a non-socket fd (TUN fd instead) and cause thesocket operation on non-socket
error:gvisor/pkg/tcpip/link/rawfile/rawfile_unsafe.go
Lines 135 to 142 in e511fc9
Steps to reproduce
Mentioned above.
runsc version
docker version (if using docker)
uname
null
kubectl (if using Kubernetes)
repo state (if built from source)
null
runsc debug logs (if available)
The text was updated successfully, but these errors were encountered: