commit 8b38694a2dc8b18374310df50174f1e4376d6824
vhost/net: virtio 1.0 byte swap
had this chunk:
- heads[headcount - 1].len += datalen;
+ heads[headcount - 1].len = cpu_to_vhost32(vq, len - datalen);
This adds datalen with the wrong sign, causing guest panics.
Fixes: 8b38694a2dc8b18374310df50174f1e4376d6824
Reported-by: Alex Williamson <alex.williamson at redhat.com>
Suggested-by: Greg Kurz <gkurz at linux.vnet.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst at redhat.com>
---
Alex, could you please confirm this fixes the crash for you?
drivers/vhost/net.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
index 14419a8..d415d69 100644
--- a/drivers/vhost/net.c
+++ b/drivers/vhost/net.c
@@ -538,7 +538,7 @@ static int get_rx_bufs(struct vhost_virtqueue *vq,
++headcount;
seg += in;
}
- heads[headcount - 1].len = cpu_to_vhost32(vq, len - datalen);
+ heads[headcount - 1].len = cpu_to_vhost32(vq, len + datalen);
*iovcount = seg;
if (unlikely(log))
*log_num = nlogs;
--
MST
On Wed, 2015-01-07 at 10:55 +0200, Michael S. Tsirkin wrote:> commit 8b38694a2dc8b18374310df50174f1e4376d6824 > vhost/net: virtio 1.0 byte swap > had this chunk: > - heads[headcount - 1].len += datalen; > + heads[headcount - 1].len = cpu_to_vhost32(vq, len - datalen); > > This adds datalen with the wrong sign, causing guest panics. > > Fixes: 8b38694a2dc8b18374310df50174f1e4376d6824 > Reported-by: Alex Williamson <alex.williamson at redhat.com> > Suggested-by: Greg Kurz <gkurz at linux.vnet.ibm.com> > Signed-off-by: Michael S. Tsirkin <mst at redhat.com> > --- > > Alex, could you please confirm this fixes the crash for you?Confirmed, this works. Thanks, Alex> drivers/vhost/net.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c > index 14419a8..d415d69 100644 > --- a/drivers/vhost/net.c > +++ b/drivers/vhost/net.c > @@ -538,7 +538,7 @@ static int get_rx_bufs(struct vhost_virtqueue *vq, > ++headcount; > seg += in; > } > - heads[headcount - 1].len = cpu_to_vhost32(vq, len - datalen); > + heads[headcount - 1].len = cpu_to_vhost32(vq, len + datalen); > *iovcount = seg; > if (unlikely(log)) > *log_num = nlogs;
Hello. On 01/07/2015 11:55 AM, Michael S. Tsirkin wrote:> commit 8b38694a2dc8b18374310df50174f1e4376d6824 > vhost/net: virtio 1.0 byte swap > had this chunk: > - heads[headcount - 1].len += datalen; > + heads[headcount - 1].len = cpu_to_vhost32(vq, len - datalen);> This adds datalen with the wrong sign, causing guest panics.> Fixes: 8b38694a2dc8b18374310df50174f1e4376d6824The format of this tag assumes 12-digit SHA1 hash and the commit description enclosed in parens and double quotes. See Documentation/SubmittingPatches.> Reported-by: Alex Williamson <alex.williamson at redhat.com> > Suggested-by: Greg Kurz <gkurz at linux.vnet.ibm.com> > Signed-off-by: Michael S. Tsirkin <mst at redhat.com>WBR, Sergei
On Wed, Jan 07, 2015 at 11:58:00PM +0300, Sergei Shtylyov wrote:> Hello. > > On 01/07/2015 11:55 AM, Michael S. Tsirkin wrote: > > >commit 8b38694a2dc8b18374310df50174f1e4376d6824 > > vhost/net: virtio 1.0 byte swap > >had this chunk: > >- heads[headcount - 1].len += datalen; > >+ heads[headcount - 1].len = cpu_to_vhost32(vq, len - datalen); > > >This adds datalen with the wrong sign, causing guest panics. > > >Fixes: 8b38694a2dc8b18374310df50174f1e4376d6824 > > The format of this tag assumes 12-digit SHA1 hash and the commit > description enclosed in parens and double quotes. See > Documentation/SubmittingPatches. > > >Reported-by: Alex Williamson <alex.williamson at redhat.com> > >Suggested-by: Greg Kurz <gkurz at linux.vnet.ibm.com> > >Signed-off-by: Michael S. Tsirkin <mst at redhat.com> > > WBR, SergeiI pushed the patches to Linus unfortunately - there's some urgency since many people are hitting the bug. Will do my best to do it right next time. -- MST