[Bug]: QEMU segfaults in spice_server_destroy on guest shutdown when a SPICE client is connected

Aperta
#2,265 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
docker, linux
Ambito
backend

Direzione di ricerca

Start by reproducing the shutdown crash with a connected SPICE client and compare it with a shutdown after disconnecting the client. The backtrace points to spice_server_destroy in libspice-server, which is reported as coming from the qemu-render package; the payload does not identify a repository file or test. Done means QEMU exits 0 after guest shutdown with a SPICE client connected.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug
Operating system

Fedora Linux 43 (Workstation Edition), kernel 7.2.13, rootless podman 5.8.4

Description
What happens

When the guest shuts down while a SPICE client is connected, QEMU segfaults on its way out. The container exits 139 and logs Segmentation fault (core dumped) from /run/entry.sh, then ERROR: QEMU exited unexpectedly! (full log below).

With no SPICE client connected, the same shutdown prints the same two VD_INTERFACE_REMOVING unsupported warnings and exits 0.

Windows has finished shutting down by then, and the next start has been clean each time, so the visible cost is the exit status and a core dump.

Expected

QEMU exits 0 after the guest powers off, whether or not a SPICE client is connected.

Versions
  • Image: dockurr/windows 6.06, sha256:16fd7c39a3e48bb946d29c59dc6015942e5b900a1fa5d7e5552053bfc48ee2ea (created 2026-10-05)
  • QEMU emulator version 11.1.1 (qemu-windows 11.2.23)
  • libspice-server.so.1.15.0, from the qemu-render package
  • Clients: remote-viewer and Looking Glass B7
To reproduce

The only change from a stock container is -spice port=5930,addr=0.0.0.0,disable-ticketing=on in ARGUMENTS, with port 5930 published (full command below).

  1. Start the container and let Windows boot.
  2. Connect a SPICE client and leave it connected: remote-viewer spice://127.0.0.1:5930.
  3. Shut the guest down: shutdown /s /t 0 in Windows, or system_powerdown on the QEMU monitor.
  4. The container exits 139.

Results so far:

  • Minimal setup above, remote-viewer connected, system_powerdown: crashed (one of one).
  • My usual setup, which also passes a vfio-pci device, an ivshmem-plain device and a vdagent channel, with Looking Glass connected: crashed three of three (two by system_powerdown, one by shutdown /s /t 0).
  • No client connected: clean exit (one of one).
  • Client closed just before system_powerdown: clean exit (one of one).
Backtrace

From the core dumps. The library has no debug symbols, so inner frames are given relative to spice_server_destroy. The frames are the same in the minimal run and in my usual setup.

#0  0x000055d688d2b6d0 in ?? ()                      <- heap address, not code
#1  libspice-server.so.1  (spice_server_destroy - 0x1d044)
#2  libspice-server.so.1  (spice_server_destroy - 0x13793)
#3  libspice-server.so.1  (spice_server_destroy - 0xf92d)
#4  libspice-server.so.1  (spice_server_destroy - 0x3157)
#5  spice_server_destroy+172
#6  qemu-system-x86_64
...
#11 __libc_start_main

The kernel reports segfault at 55d688d2b6d0 ip 000055d688d2b6d0 ... error 15: an instruction fetch from a non-executable page. In the one core I inspected in detail, the memory at the faulting address was a freed malloc chunk (a chunk header, then pointers into main_arena), so frame 1 is calling through a pointer read from freed memory. It looks like a use-after-free in the teardown of a channel or client that is still connected.

The log below is from a run of my usual setup. The minimal run ended with the same four lines.

Docker compose
podman run -d --name windows \
  -e VERSION=11 -e RAM_SIZE=6G -e CPU_CORES=4 -e DISK_SIZE=64G \
  -p 127.0.0.1:8006:8006 -p 127.0.0.1:5930:5930 \
  --device=/dev/kvm --device=/dev/net/tun --cap-add NET_ADMIN \
  --security-opt label=disable \
  -e ARGUMENTS="-spice port=5930,addr=0.0.0.0,disable-ticketing=on" \
  -v ~/vms/windows:/storage --stop-timeout 120 docker.io/dockurr/windows
Docker log
❯ Starting Windows for Podman v6.06...
❯ For support visit https://github.com/dockur/windows
❯ CPU: Intel Core i7 1365U | RAM: 26/31 GB | DISK: 163 GB (btrfs) | KERNEL: 7.2.13-100.fc43.x86_64

❯ Warning: you are using the BTRFS filesystem for /storage, this might introduce issues with Windows Setup!

❯ Host: <ip>/20 (85f096c05131)  |  Gateway: <ip>  |  Interface: wlp0s20f3/tun  |  MTU: 65520  |  DNS: 169.254.1.1, 8.8.8.8, 8.8.4.4
❯ Guest: <ip> (Windows)  |  Mode: User (passt)  |  MAC: <mac>

❯ Booting Windows using QEMU v11.1.1...

BdsDxe: loading Boot0005 "Windows Boot Manager" from HD(1,GPT,0DAA3B88-7C12-47C7-9F52-CE7087A82C41,0x800,0x40000)/\EFI\Microsoft\Boot\bootmgfw.efi
BdsDxe: starting Boot0005 "Windows Boot Manager" from HD(1,GPT,0DAA3B88-7C12-47C7-9F52-CE7087A82C41,0x800,0x40000)/\EFI\Microsoft\Boot\bootmgfw.efi

❯ Windows started successfully, visit http://127.0.0.1:8006/ to view the screen...

qemu-system-x86_64: warning: Spice: ../src/spice/server/reds.cpp:3390:spice_server_remove_interface: VD_INTERFACE_REMOVING unsupported
qemu-system-x86_64: warning: Spice: ../src/spice/server/reds.cpp:3390:spice_server_remove_interface: VD_INTERFACE_REMOVING unsupported
/run/entry.sh: line 73:   740 Segmentation fault      (core dumped) "${cmd[@]}" ${ARGS:+ $ARGS} > "$pipe" 2>&1

❯ ERROR: QEMU exited unexpectedly!
Screenshots (optional)

No response

Lingua principale
Shell
Stelle
54.2k
Fork
5.2k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di dockur/windows

Tutte le issue di dockur/windows

Issue simili

Altre issue su Shell/Bash

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.