vhost/net: length miscalculation
Subsystems (5)
Michael S. Tsirkin
maintainerPATCH 1/1 vhost/net: length miscalculation
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.
---
Alex, could you please confirm this fixes the crash for you?
drivers/vhost/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vhost/net.c +1 -1
@@ -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;
Signature · 1 line
MST
Quoted 8 lines · Michael S. Tsirkin
commit
8b38694a2dc8b18374310df50174f1e4376d6824
vhost/net: virtio 1.0 byte swap
had this chunk:(quoted diff) +1
-1- 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.
Quoted 7 lines
Fixes 8b38694a2dc8b18374310df50174f1e4376d6824Reported-by Alex Williamson <[email protected]>Suggested-by Greg Kurz <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>---
Alex, could you please confirm this fixes the crash for you?
Confirmed, this works. Thanks,
Alex
Quoted 16 lines
drivers/vhost/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/vhost/net.c +1
-1@@ -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;
Quoted 8 lines · Michael S. Tsirkin
commit
8b38694a2dc8b18374310df50174f1e4376d6824
vhost/net: virtio 1.0 byte swap
had this chunk:(quoted diff) +1
-1- 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.
Quoted 7 lines
Fixes 8b38694a2dc8b18374310df50174f1e4376d6824Reported-by Alex Williamson <[email protected]>Suggested-by Greg Kurz <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>---
Alex, could you please confirm this fixes the crash for you?
Confirmed, this works. Thanks,
Alex
Quoted 16 lines
drivers/vhost/net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/vhost/net.c +1
-1@@ -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.
Quoted 9 lines · Michael S. Tsirkin
commit
8b38694a2dc8b18374310df50174f1e4376d6824
vhost/net: virtio 1.0 byte swap
had this chunk:(quoted diff) +1
-1- 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.
Quoted 3 lines
Reported-by Alex Williamson <[email protected]>Suggested-by Greg Kurz <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>
WBR, Sergei
Michael S. Tsirkin
maintainerQuoted 18 lines · Sergei Shtylyov
Hello.
Quoted 9 lines · Michael S. Tsirkin
commit
8b38694a2dc8b18374310df50174f1e4376d6824
vhost/net: virtio 1.0 byte swap
had this chunk:(quoted diff) +1
-1- 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. SeeDocumentation/SubmittingPatches.
Quoted 5 lines
Quoted 3 lines
Reported-by Alex Williamson <[email protected]>Suggested-by Greg Kurz <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>WBR, Sergei
I 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.
Signature · 1 line
MST
Hello.
Quoted 9 lines · Michael S. Tsirkin
commit
8b38694a2dc8b18374310df50174f1e4376d6824
vhost/net: virtio 1.0 byte swap
had this chunk:(quoted diff) +1
-1- 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.
Quoted 3 lines
Reported-by Alex Williamson <[email protected]>Suggested-by Greg Kurz <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>
WBR, Sergei