virtio-blk: BDRV_REQ_REGISTERED_BUF optimization hint crashes on macOS
Host environment
- Operating system: macOS 13.0.1
- OS/kernel version:
Kernel Version 22.1.0: Sun Oct 9 20:14:30 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T8103 arm64
- Architecture: ARM64
- QEMU flavor: qemu-system-aarch64
- QEMU version: 7.2.0
- QEMU command line:
$ qemu-system-aarch64 -nodefaults -vga none -device virtio-ramfb -cpu host -smp 4 -machine virt -accel hvf -drive if=pflash,format=raw,unit=0,file=/opt/homebrew/share/qemu/edk2-aarch64-code.fd,readonly=on -m 4096 -device nec-usb-xhci,id=usb-bus -device -device usb-mouse,bus=usb-bus.0 -device usb-kbd,bus=usb-bus.0 -device usb-storage,drive=driveA2720109-2AE3-464E-AFE3-ADAEA45B3936,removable=true,bootindex=0,bus=usb-bus.0 -drive if=none,media=cdrom,id=driveA2720109-2AE3-464E-AFE3-ADAEA45B3936,file=/Users/admin/Downloads/ubuntu-22.04-live-server-arm64.iso -device virtio-blk-pci,drive=drive437EC806-41A4-4CCE-A747-713352E7C27C,bootindex=1 -drive if=none,media=disk,id=drive437EC806-41A4-4CCE-A747-713352E7C27C,file=/Users/admin/Downloads/437EC806-41A4-4CCE-A747-713352E7C27C.qcow2,discard=unmap,detect-zeroes=unmap
Emulated/Virtualized environment
- Operating system: Ubuntu 22.04
- OS/kernel version:
- Architecture: ARM64
Description of problem
When using QEMU 7.2.0 on macOS with the virtio-blk drive, the process will exit and QMP shows a BLOCK_IO_ERROR
event. This appears to be caused by this line: https://gitlab.com/qemu-project/qemu/-/blob/master/hw/block/virtio-blk.c#L405 introduced in baf42268
Commenting that line out fixes the issue.
Steps to reproduce
- Run the QEMU command above with a Ubuntu 22.04 server ISO image.
- Follow the installer and try to get to the end.
- The process will crash before you can finish installing.
Additional information
Following event appears on QMP:
{
data = {
action = report;
device = "drive437EC806-41A4-4CCE-A747-713352E7C27C";
"node-name" = "#block785";
nospace = 0;
operation = write;
reason = "Invalid argument";
};
event = "BLOCK_IO_ERROR";
timestamp = {
microseconds = 808474;
seconds = 1671867673;
};
}