* VIRTIO_VSOCK_OP_REQUEST with the same src_port from a guest
@ 2024-07-01 17:35 Roman Kiryanov
2024-07-01 18:44 ` Michael S. Tsirkin
0 siblings, 1 reply; 6+ messages in thread
From: Roman Kiryanov @ 2024-07-01 17:35 UTC (permalink / raw)
To: virtio-dev; +Cc: JP Cottin
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: VIRTIO_VSOCK_OP_REQUEST with the same src_port from a guest
2024-07-01 17:35 VIRTIO_VSOCK_OP_REQUEST with the same src_port from a guest Roman Kiryanov
@ 2024-07-01 18:44 ` Michael S. Tsirkin
2024-07-01 19:16 ` Roman Kiryanov
0 siblings, 1 reply; 6+ messages in thread
From: Michael S. Tsirkin @ 2024-07-01 18:44 UTC (permalink / raw)
To: Roman Kiryanov; +Cc: virtio-dev, JP Cottin
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: VIRTIO_VSOCK_OP_REQUEST with the same src_port from a guest
2024-07-01 18:44 ` Michael S. Tsirkin
@ 2024-07-01 19:16 ` Roman Kiryanov
2024-07-01 19:40 ` Michael S. Tsirkin
0 siblings, 1 reply; 6+ messages in thread
From: Roman Kiryanov @ 2024-07-01 19:16 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: virtio-dev, JP Cottin
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 <mst@redhat.com> 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
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: VIRTIO_VSOCK_OP_REQUEST with the same src_port from a guest
2024-07-01 19:16 ` Roman Kiryanov
@ 2024-07-01 19:40 ` Michael S. Tsirkin
2024-07-01 19:55 ` Roman Kiryanov
0 siblings, 1 reply; 6+ messages in thread
From: Michael S. Tsirkin @ 2024-07-01 19:40 UTC (permalink / raw)
To: Roman Kiryanov; +Cc: virtio-dev, JP Cottin
On Mon, Jul 01, 2024 at 12:16:15PM -0700, Roman Kiryanov wrote:
> 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.
Can Linux driver ever trigger this? Some other driver?
If this is something that drivers don't actually ever
trigger, why does it matter how exactly the device
behaves?
--
MST
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: VIRTIO_VSOCK_OP_REQUEST with the same src_port from a guest
2024-07-01 19:40 ` Michael S. Tsirkin
@ 2024-07-01 19:55 ` Roman Kiryanov
2024-07-01 21:01 ` Michael S. Tsirkin
0 siblings, 1 reply; 6+ messages in thread
From: Roman Kiryanov @ 2024-07-01 19:55 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: virtio-dev, JP Cottin
On Mon, Jul 1, 2024 at 12:40 PM Michael S. Tsirkin <mst@redhat.com> wrote:
> Can Linux driver ever trigger this? Some other driver?
I have never seen a driver with this behavior so far.
> If this is something that drivers don't actually ever
> trigger, why does it matter how exactly the device
> behaves?
I think there is a value in having the spec to cover all cases.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: VIRTIO_VSOCK_OP_REQUEST with the same src_port from a guest
2024-07-01 19:55 ` Roman Kiryanov
@ 2024-07-01 21:01 ` Michael S. Tsirkin
0 siblings, 0 replies; 6+ messages in thread
From: Michael S. Tsirkin @ 2024-07-01 21:01 UTC (permalink / raw)
To: Roman Kiryanov; +Cc: virtio-dev, JP Cottin
On Mon, Jul 01, 2024 at 12:55:46PM -0700, Roman Kiryanov wrote:
> On Mon, Jul 1, 2024 at 12:40 PM Michael S. Tsirkin <mst@redhat.com> wrote:
> > Can Linux driver ever trigger this? Some other driver?
>
> I have never seen a driver with this behavior so far.
>
> > If this is something that drivers don't actually ever
> > trigger, why does it matter how exactly the device
> > behaves?
>
> I think there is a value in having the spec to cover all cases.
Well we don't really do it for other devices.
We focus on how things fail when it's important e.g. for security.
Basically spec has been out there for a while and we can't
declare existing devices non-compliant.
We can add a recommendation.
Given no driver actually does this, the value seems low.
--
MST
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-07-01 21:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-01 17:35 VIRTIO_VSOCK_OP_REQUEST with the same src_port from a guest Roman Kiryanov
2024-07-01 18:44 ` Michael S. Tsirkin
2024-07-01 19:16 ` Roman Kiryanov
2024-07-01 19:40 ` Michael S. Tsirkin
2024-07-01 19:55 ` Roman Kiryanov
2024-07-01 21:01 ` Michael S. Tsirkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox