Re: VIRTIO_VSOCK_OP_REQUEST with the same src_port from a guest

Roman Kiryanov <[email protected]> Mon, 1 Jul 2024 12:16:15 -0700
Newsgroups dev.linux.lists.virtio-dev
Message-ID <CAOGAQepE5G+yR0FQMFW8oZ24p0DVKZgmkDJsB09hbxF+P7KvCQ@mail.gmail.com>
Hi Michael, thank you for looking.

as I mentioned, I have never seen this happening.

But this code path (on the device side) exists (e.g. insertion of
<dst_port, src_port> to a
hash table says that the key already exists) even if it is never taken
and I would be nice
if the virtio-spec mentioned explicitly what to do there.

Regards,
Roman.


On Mon, Jul 1, 2024 at 11:44 AM Michael S. Tsirkin <[email protected]> wrote:
>
> On Mon, Jul 01, 2024 at 10:35:57AM -0700, Roman Kiryanov wrote:
> > Hi virtio-dev,
> >
> > we (Android Studio Emulator) have our own implementation of
> > virtio-vsock and we recently found that the virtio spec does not cover
> > the situation if a guest sends a VIRTIO_VSOCK_OP_REQUEST packet with
> > the same src_port that is already registered on the device side.
> >
> > This sounds like an error to me and I don't think I ever saw this
> > happening, but it would be nice if the spec explicitly mentioned how
> > this situation should be handled on the device side.
> >
> > The spec does mention "A VIRTIO_VSOCK_OP_RST reply is sent if ... the
> > destination has insufficient resources to establish the connection",
> > but I am not sure if this includes the duplicate src_port case. I
> > think this means the previously established connection will be broken.
> >
> > Thank you.
> >
> > Regards,
> > Roman.
>
> Another way is just to forbid this from happening.
>
> How does this happen on the driver side?
> --
> MST
>