From 2495c0ae52eccb532e49f4762b358545f4a6531c Mon Sep 17 00:00:00 2001 From: dv Date: Fri, 3 Nov 2023 11:16:43 +0000 Subject: [PATCH] vmd(8): fix block size calculation for vioscsi devices. During the multi-process rework, I changed the way disk sizes are calculated, switching to storing bytes and not 512-byte blocks. The size calculation from reading an iso did not receive the change in scaling, resulting in the virtio scsi emulation to think iso's are larger than reality. This fixes booting the latest Ubuntu amd64 iso's as apparently there's some program that tries to arbitrarily read the tail end of the iso into memory. ok mlarkin@ --- usr.sbin/vmd/virtio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.sbin/vmd/virtio.c b/usr.sbin/vmd/virtio.c index e4795cfb7e7..cca6e041046 100644 --- a/usr.sbin/vmd/virtio.c +++ b/usr.sbin/vmd/virtio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: virtio.c,v 1.109 2023/09/26 01:53:54 dv Exp $ */ +/* $OpenBSD: virtio.c,v 1.110 2023/11/03 11:16:43 dv Exp $ */ /* * Copyright (c) 2015 Mike Larkin @@ -719,7 +719,7 @@ virtio_init(struct vmd_vm *vm, int child_cdrom, } vioscsi->locked = 0; vioscsi->lba = 0; - vioscsi->n_blocks = vioscsi->sz >> 2; /* num of 2048 blocks in file */ + vioscsi->n_blocks = vioscsi->sz / VIOSCSI_BLOCK_SIZE_CDROM; vioscsi->max_xfer = VIOSCSI_BLOCK_SIZE_CDROM; vioscsi->pci_id = id; vioscsi->vm_id = vcp->vcp_id; -- 2.20.1