From: dv Date: Fri, 3 Nov 2023 11:16:43 +0000 (+0000) Subject: vmd(8): fix block size calculation for vioscsi devices. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2495c0ae52eccb532e49f4762b358545f4a6531c;p=openbsd 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@ --- 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;