qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] virtio-serial: fix ANY_LAYOUT
@ 2015-07-27  6:37 Michael S. Tsirkin
  2015-07-27  6:41 ` Amit Shah
  2015-07-27  7:41 ` Jason Wang
  0 siblings, 2 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2015-07-27  6:37 UTC (permalink / raw)
  To: qemu-devel; +Cc: Amit Shah

Don't assume a specific layout for control messages.
Required by virtio 1.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/char/virtio-serial-bus.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
index 78c73e5..16de50f 100644
--- a/hw/char/virtio-serial-bus.c
+++ b/hw/char/virtio-serial-bus.c
@@ -195,7 +195,8 @@ static size_t send_control_msg(VirtIOSerial *vser, void *buf, size_t len)
         return 0;
     }
 
-    memcpy(elem.in_sg[0].iov_base, buf, len);
+    /* TODO: detect a buffer that's too short, set NEEDS_RESET */
+    iov_from_buf(&elem.in_sg, buf, len);
 
     virtqueue_push(vq, &elem, len);
     virtio_notify(VIRTIO_DEVICE(vser), vq);
-- 
MST

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-serial: fix ANY_LAYOUT
  2015-07-27  6:37 [Qemu-devel] [PATCH] virtio-serial: fix ANY_LAYOUT Michael S. Tsirkin
@ 2015-07-27  6:41 ` Amit Shah
  2015-07-27  7:40   ` Michael S. Tsirkin
  2015-07-27  7:41 ` Jason Wang
  1 sibling, 1 reply; 4+ messages in thread
From: Amit Shah @ 2015-07-27  6:41 UTC (permalink / raw)
  To: Michael S. Tsirkin; +Cc: qemu-devel

On (Mon) 27 Jul 2015 [09:37:47], Michael S. Tsirkin wrote:
> Don't assume a specific layout for control messages.
> Required by virtio 1.
> 
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

Reviewed-by: Amit Shah <amit.shah@redhat.com>

> ---
>  hw/char/virtio-serial-bus.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
> index 78c73e5..16de50f 100644
> --- a/hw/char/virtio-serial-bus.c
> +++ b/hw/char/virtio-serial-bus.c
> @@ -195,7 +195,8 @@ static size_t send_control_msg(VirtIOSerial *vser, void *buf, size_t len)
>          return 0;
>      }
>  
> -    memcpy(elem.in_sg[0].iov_base, buf, len);
> +    /* TODO: detect a buffer that's too short, set NEEDS_RESET */
> +    iov_from_buf(&elem.in_sg, buf, len);

Not sure why NEEDS_RESET -- anyhow, you planning on doing this?


		Amit

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-serial: fix ANY_LAYOUT
  2015-07-27  6:41 ` Amit Shah
@ 2015-07-27  7:40   ` Michael S. Tsirkin
  0 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2015-07-27  7:40 UTC (permalink / raw)
  To: Amit Shah; +Cc: qemu-devel

On Mon, Jul 27, 2015 at 12:11:36PM +0530, Amit Shah wrote:
> On (Mon) 27 Jul 2015 [09:37:47], Michael S. Tsirkin wrote:
> > Don't assume a specific layout for control messages.
> > Required by virtio 1.
> > 
> > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> 
> Reviewed-by: Amit Shah <amit.shah@redhat.com>
> 
> > ---
> >  hw/char/virtio-serial-bus.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
> > index 78c73e5..16de50f 100644
> > --- a/hw/char/virtio-serial-bus.c
> > +++ b/hw/char/virtio-serial-bus.c
> > @@ -195,7 +195,8 @@ static size_t send_control_msg(VirtIOSerial *vser, void *buf, size_t len)
> >          return 0;
> >      }
> >  
> > -    memcpy(elem.in_sg[0].iov_base, buf, len);
> > +    /* TODO: detect a buffer that's too short, set NEEDS_RESET */
> > +    iov_from_buf(&elem.in_sg, buf, len);
> 
> Not sure why NEEDS_RESET -- anyhow, you planning on doing this?
> 
> 
> 		Amit

Definitely not for 2.4.
It's a guest bug, we need a consistent strategy for handling these.

-- 
MST

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] virtio-serial: fix ANY_LAYOUT
  2015-07-27  6:37 [Qemu-devel] [PATCH] virtio-serial: fix ANY_LAYOUT Michael S. Tsirkin
  2015-07-27  6:41 ` Amit Shah
@ 2015-07-27  7:41 ` Jason Wang
  1 sibling, 0 replies; 4+ messages in thread
From: Jason Wang @ 2015-07-27  7:41 UTC (permalink / raw)
  To: Michael S. Tsirkin, qemu-devel; +Cc: Amit Shah



On 07/27/2015 02:37 PM, Michael S. Tsirkin wrote:
> Don't assume a specific layout for control messages.
> Required by virtio 1.
>
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>  hw/char/virtio-serial-bus.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
> index 78c73e5..16de50f 100644
> --- a/hw/char/virtio-serial-bus.c
> +++ b/hw/char/virtio-serial-bus.c
> @@ -195,7 +195,8 @@ static size_t send_control_msg(VirtIOSerial *vser, void *buf, size_t len)
>          return 0;
>      }
>  
> -    memcpy(elem.in_sg[0].iov_base, buf, len);
> +    /* TODO: detect a buffer that's too short, set NEEDS_RESET */
> +    iov_from_buf(&elem.in_sg, buf, len);
>  
>      virtqueue_push(vq, &elem, len);
>      virtio_notify(VIRTIO_DEVICE(vser), vq);

Reviewed-by: Jason Wang <jasowang@redhat.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-07-27  7:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-27  6:37 [Qemu-devel] [PATCH] virtio-serial: fix ANY_LAYOUT Michael S. Tsirkin
2015-07-27  6:41 ` Amit Shah
2015-07-27  7:40   ` Michael S. Tsirkin
2015-07-27  7:41 ` Jason Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).