Skip to contentSkip to conversation

vhost-user-scsi: prevent using uninitialized vqs

PATCH In review Raphael Norwitz 4 participants 7 messages Jun 12, 2019 – Aug 22, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vhost-user-scsi: prevent using uninitialized vqs

Of the 3 virtqueues, seabios only sets cmd, leaving ctrl and event without a physical address. This can cause vhost_verify_ring_part_mapping to return ENOMEM, causing the following logs:

qemu-system-x86_64: Unable to map available ring for ring 0
qemu-system-x86_64: Verify ring failure on region 0

The qemu commit e6cc11d64fc998c11a4dfcde8fda3fc33a74d844 has already resolved the issue for vhost scsi devices but the fix was never applied to vhost-user scsi devices.

---
 hw/scsi/vhost-user-scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/scsi/vhost-user-scsi.c +1 -1
index a9fd8ea..e4aae95 100644
@@ -91,7 +91,7 @@ static void vhost_user_scsi_realize(DeviceState *dev, Error **errp)
     }
 
     vsc->dev.nvqs = 2 + vs->conf.num_queues;
-    vsc->dev.vqs = g_new(struct vhost_virtqueue, vsc->dev.nvqs);
+    vsc->dev.vqs = g_new0(struct vhost_virtqueue, vsc->dev.nvqs);
     vsc->dev.vq_index = 0;
     vsc->dev.backend_features = 0;
     vqs = vsc->dev.vqs;
Signature · 1 line
1.9.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Raphael Norwitz

Of the 3 virtqueues, seabios only sets cmd, leaving ctrl and event without a physical address. This can cause vhost_verify_ring_part_mapping to return ENOMEM, causing the following logs:

qemu-system-x86_64: Unable to map available ring for ring 0
qemu-system-x86_64: Verify ring failure on region 0

Quoted 8 lines

The qemu commit e6cc11d64fc998c11a4dfcde8fda3fc33a74d844 has already resolved the issue for vhost scsi devices but the fix was never applied to vhost-user scsi devices.

---
 hw/scsi/vhost-user-scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#2 lore raw
Quoted 13 lines · Stefan Hajnoczi
Quoted 12 lines · Raphael Norwitz

Of the 3 virtqueues, seabios only sets cmd, leaving ctrl and event without a physical address. This can cause vhost_verify_ring_part_mapping to return ENOMEM, causing the following logs:

qemu-system-x86_64: Unable to map available ring for ring 0
qemu-system-x86_64: Verify ring failure on region 0

The qemu commit e6cc11d64fc998c11a4dfcde8fda3fc33a74d844 has already resolved the issue for vhost scsi devices but the fix was never applied to vhost-user scsi devices.

Quoted 6 lines
Quoted 4 lines
---
 hw/scsi/vhost-user-scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Ping on this. Any reason it has not been merged?

#3 lore raw
Quoted 14 lines · Raphael Norwitz
Quoted 13 lines · Stefan Hajnoczi
Quoted 12 lines · Raphael Norwitz

Of the 3 virtqueues, seabios only sets cmd, leaving ctrl and event without a physical address. This can cause vhost_verify_ring_part_mapping to return ENOMEM, causing the following logs:

qemu-system-x86_64: Unable to map available ring for ring 0
qemu-system-x86_64: Verify ring failure on region 0

The qemu commit e6cc11d64fc998c11a4dfcde8fda3fc33a74d844 has already resolved the issue for vhost scsi devices but the fix was never applied to vhost-user scsi devices.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
---
 hw/scsi/vhost-user-scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Ping on this. Any reason it has not been merged?

I had missed it. I have now queued it (but I won't send another pull request until approx. the middle of September).

Paolo

#4 lore raw
In reply to Raphael Norwitz
Quoted 14 lines · Raphael Norwitz
Quoted 13 lines · Stefan Hajnoczi
Quoted 12 lines · Raphael Norwitz

Of the 3 virtqueues, seabios only sets cmd, leaving ctrl and event without a physical address. This can cause vhost_verify_ring_part_mapping to return ENOMEM, causing the following logs:

qemu-system-x86_64: Unable to map available ring for ring 0
qemu-system-x86_64: Verify ring failure on region 0

The qemu commit e6cc11d64fc998c11a4dfcde8fda3fc33a74d844 has already resolved the issue for vhost scsi devices but the fix was never applied to vhost-user scsi devices.

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
---
 hw/scsi/vhost-user-scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Ping on this. Any reason it has not been merged?

I think Paolo is away on vacation. I will send it through my tree instead.

Stefan

#5 lore raw
In reply to Stefan Hajnoczi

Hi Raphael, Stefan,

Quoted 13 lines · Stefan Hajnoczi
Quoted 12 lines · Raphael Norwitz

Of the 3 virtqueues, seabios only sets cmd, leaving ctrl and event without a physical address. This can cause vhost_verify_ring_part_mapping to return ENOMEM, causing the following logs:

qemu-system-x86_64: Unable to map available ring for ring 0
qemu-system-x86_64: Verify ring failure on region 0

The qemu commit e6cc11d64fc998c11a4dfcde8fda3fc33a74d844 has already resolved the issue for vhost scsi devices but the fix was never applied to vhost-user scsi devices.

Quoted 7 lines
Quoted 4 lines
---
 hw/scsi/vhost-user-scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

What about backends/vhost-user.c and hw/block/vhost-user-blk.c?

#6 lore raw
Quoted 21 lines · Philippe Mathieu-Daudé

Hi Raphael, Stefan,

Quoted 18 lines · Stefan Hajnoczi
Quoted 16 lines · Raphael Norwitz

Of the 3 virtqueues, seabios only sets cmd, leaving ctrl and event without a physical address. This can cause vhost_verify_ring_part_mapping to return ENOMEM, causing the following logs:

qemu-system-x86_64: Unable to map available ring for ring 0
qemu-system-x86_64: Verify ring failure on region 0

The qemu commit e6cc11d64fc998c11a4dfcde8fda3fc33a74d844 has already resolved the issue for vhost scsi devices but the fix was never applied to vhost-user scsi devices.

---
 hw/scsi/vhost-user-scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 5 lines
Quoted 2 lines

What about backends/vhost-user.c and hw/block/vhost-user-blk.c?

It is clearly an issue for hw/block/vhost-user-blk.c The code is very similar.

backends/vhost-user.c also fails to zero out the vqs.

I will send the patches.