@samitouri / QOSamiQemu / commits / 27806d2ddb

vhost: do not crash on ring map failure

When vhost_commit() rebuilds the memory region table after a flatview change, it revalidates cached host virtual addresses for active vring parts. If a mapping is stale, QEMU abort(). This is not a security problem - only the priviledged guest can control make it invalid - but not nice e.g. for driver debugging. Let's call virtio_error() instead, marking the device as broken. Fixes: 0ca1fd2d68 ("vhost: Simplify ring verification checks") Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3783 Cc: Stefano Garzarella <sgarzare@redhat.com> Cc: Dr. David Alan Gilbert <dave@treblig.org> Reported-by: Feifan Qian <bea1e@proton.me> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Message-ID: <71961a7dc157f552303aeea8c99a75c5e1ce904e.1784898432.git.mst@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dave@treblig.org>

Michael S. Tsirkin committed Jul 8, 2026 at 11:35 UTC 27806d2ddba2da97fb4137cba7d4172356c42914
1 file changed +3 -2
hw/virtio/vhost.c
+3 -2
@@ -755,8 +755,9 @@ static void vhost_commit(MemoryListener *listener)
755 (void *)(uintptr_t)dev->mem->regions[i].userspace_addr,
756 dev->mem->regions[i].guest_phys_addr,
757 dev->mem->regions[i].memory_size)) {
758 - error_report("Verify ring failure on region %d", i);
759 - abort();
758 + virtio_error(dev->vdev,
759 + "Verify ring failure on region %d", i);
760 + goto out;
761 }
762 }
763