Virtio-vga with blobs on fails, when qemu compiled with enabled modules
Host environment
- Operating system: Manjaro Linux
- OS/kernel version:
Linux max 5.13.11-1-MANJARO #1 SMP PREEMPT Sun Aug 15 13:15:18 UTC 2021 x86_64 GNU/Linux
- Architecture: x86 (others may be affected too)
- QEMU flavor: qemu-system-x86_64
- QEMU version:
QEMU emulator version 6.0.94 (v6.1.0-rc4-dirty)
- QEMU command line:
sudo ./qemu-system-x86_64 \ -object memory-backend-memfd,id=mem1,size=512M \ -machine memory-backend=mem1 \ -display sdl \ -device virtio-vga,blob=on
Emulated/Virtualized environment
- Bug happens before launching system
Description of problem
When using qemu configured with --enabled-modules
and starting qemu with command line above, qemu crashes with following output:
qemu-system-x86_64: -device virtio-vga,blob=on: cannot enable blob resources without udmabuf
While qemu configured without --enabled-modules
runs this command successfully.
Steps to reproduce
- Get latest qemu source code
- Build qemu
mkdir build && cd build && ../configure && ninja
- Check if following command runs without errors and show sdl qemu window
sudo ./qemu-system-x86_64 \
-object memory-backend-memfd,id=mem1,size=512M \
-machine memory-backend=mem1 \
-display sdl \
-device virtio-vga,blob=on
- Then try to build with modules enabled
mkdir build && cd build && ../configure --enable-modules && ninja
- Try to do step 3 again
Additional information
I tried to debug this bug, and found that problem is with function virtio_gpu_have_udmabuf
: when qemu is build without modules this function is from hw/display/virtio-gpu-udmabuf.c
(which is correct), but when qemu compiled with modules this function comes from stubs/virtio-gpu-udmabuf.c
and when hw-display-virtio-gpu.so
is loaded, virtio_gpu_have_udmabuf
is not replaced, and remains function from stub (which always return 0) and command fails.
I think I will submit patch that fix it tomorrow