** Description changed: + [ Impact ] + + * libvirtd crashs when users tries to hotplug a virtiofs into a VM + running in session mode (qemu:///session) + + [ Test Plan ] + + $ sudo apt install qemu-system-x86 libvirt-daemon-system libvirt-clients ovmf + $ sudo apt install virtiofsd uidmap + + $ cat vm.xml + + <domain type='qemu'> + <name>test</name> + <memory unit='MiB'>2048</memory> + <vcpu>2</vcpu> + + <os> + <type arch='x86_64' machine='q35'>hvm</type> + </os> + + <cpu mode='custom' match='exact'> + <model fallback='allow'>qemu64</model> + </cpu> + + <features> + <acpi/> + <apic/> + </features> + + <!-- Force TCG (no KVM) --> + <devices> + <emulator>/usr/bin/qemu-system-x86_64</emulator> + + <controller type='pci' model='pcie-root'/> + <controller type='virtio-serial'/> + + <console type='pty'/> + </devices> + + <!-- Required for virtio-fs --> + <memoryBacking> + <source type='memfd'/> + <access mode='shared'/> + </memoryBacking> + </domain> + + $ virsh -c qemu:///session define vm.xml + $ virsh -c qemu:///session start test + $ virt-xml -c qemu:///session test --update --add-device --filesystem type=mount,accessmode=passthrough,driver.type=virtiofs,source.dir=/home/ubuntu/tmp,target.dir=mnt + + -> without the fix, libvirtd crashs + + + [ Where problems could occur ] + + * This is one line fix that basically do a sanity check + however it enables the virtiofsd feature for session VMs, problems could + occur during the use of this feature. + + [ Other Info ] + + * Upstream has the fix starting from version v10.2 so Questing onwards is ok + We just need to backport it to Noble and eventually to Jammy. + + + ---- Original report ---- + Ubuntu 24.04.3 LTS libvirt-daemon 10.0.0-2ubuntu8.11 When adding a filesystem to a running VM on the session connection, libvirtd crashes. Steps to reproduce: - Make a VM on the session connection. I believe the details don't matter. Stop it. - Set the necessary "memory backing" parameters. - $ virt-xml -c qemu:///session subVmTest1 --edit 1 --memorybacking + $ virt-xml -c qemu:///session subVmTest1 --edit 1 --memorybacking access.mode=shared,source.type=memfd - Start the machine. - $ virsh -c qemu:///session start subVmTest1 + $ virsh -c qemu:///session start subVmTest1 - Add a filesystem with virt-xml. - $ virt-xml -c qemu:///session subVmTest1 --update --add-device --filesystem type=mount,accessmode=passthrough,driver.type=virtiofs,source.dir=/mnt,target.dir=mnt - ERROR Error attempting device hotplug: End of file while reading data: Input/output error + $ virt-xml -c qemu:///session subVmTest1 --update --add-device --filesystem type=mount,accessmode=passthrough,driver.type=virtiofs,source.dir=/mnt,target.dir=mnt + ERROR Error attempting device hotplug: End of file while reading data: Input/output error This will be in the journal: - Jan 22 14:32:37 ubuntu systemd-coredump[2104]: [🡕] Process 1728 + Jan 22 14:32:37 ubuntu systemd-coredump[2104]: [🡕] Process 1728 (libvirtd) of user 1000 terminated abnormally without generating a coredump. - Repeating the attempt fails differently. - $ virt-xml -c qemu:///session subVmTest1 --update --add-device --filesystem type=mount,accessmode=passthrough,driver.type=virtiofs,source.dir=/mnt,target.dir=mnt - ERROR Error attempting device hotplug: Cannot open log file: '/home/admin/.cache/libvirt/qemu/log/subVmTest1-fs0-virtiofsd.log': Device or resource busy + $ virt-xml -c qemu:///session subVmTest1 --update --add-device --filesystem type=mount,accessmode=passthrough,driver.type=virtiofs,source.dir=/mnt,target.dir=mnt + ERROR Error attempting device hotplug: Cannot open log file: '/home/admin/.cache/libvirt/qemu/log/subVmTest1-fs0-virtiofsd.log': Device or resource busy The content of that file is: [2026-01-22T14:39:20Z WARN virtiofsd] Use of deprecated option format '-o': Please specify options without it (e.g., '--cache auto' instead of '-o cache=auto') [2026-01-22T14:39:20Z WARN virtiofsd::sandbox] Couldn't set the process uid as root: -1 [2026-01-22T14:39:20Z WARN virtiofsd::sandbox] Couldn't set the process gid as root: -1 [2026-01-22T14:39:20Z INFO virtiofsd] Waiting for vhost-user socket connection...
-- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2138902 Title: session libvirtd crashes when hot adding filesystems To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/2138902/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
