virtio-win/kvm-guest-drivers-windows

vsock: Incorrect number of bytes of data received from vsock on Windows

niceguy135 opened this issue · 1 comments

Describe the bug
A test script is running on the host, sending bytes of data over vsock. Another application that has developed with a wrapper for working with vsock receives this data on Windows guest.

The problem is that vsok on the WIndows side reads randomly more or less data than was sent from the Linux side.

TraceView logs:
LogSession0.txt

To Reproduce
On Linux host run this:
vsock_test.txt

On Windows guest run this:
client_test.txt
With this imported vsock wrapper:
winSock.txt

Expected behavior
Well, I kind of expect WIndows to receive exactly as many bytes over vsock as it is sent)

Screenshots

From Linux host:
Linux host terminal screanshoot

From Windows guest:
cmd

Host:

  • Disto: "Linux Mint 21.1 (Vera)"
  • Kernel version: 5.15.0-91-generic
  • QEMU version: QEMU emulator version 6.2.0 (Debian 1:6.2+dfsg-2ubuntu6.15)
  • QEMU command line: launch from VirtManager app (i think qemu-system-x86_64 will be good)
  • libvirt version: 6.2.0
  • libvirt XML file for windows:
    windows10.txt

VM:

  • Windows version: Windows 10 Pro Build 19041.vb_release.191206-1206
  • Which driver has a problem: viosock
  • last commit hash: 515a6a2

Additional context
The problem disappears (for the current test) if you increase the buffer. But this approach to solving the problem does not seem right to me

Hello,

IMHO this is a feature, not a bug. The socket is of the SOCK_STREAM; type which means that data are being sent and received as a stream of bytes. Thus, sending **N** bytes in one sendcall does not imply their reception in onerecv` call. It depends on how quickly the data are transferred between the host and the VM.

You would need a datagram (message-based) socket, however, I do not think such sockets are supported by the Socket driver at the moment.