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

Open
#2,265 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
docker, linux
Domain
backend

Research direction

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.

Written by the indexing model from the issue text.

Description

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

Dominant language
Shell
Stars
54.2k
Forks
5.2k
PR merge metrics
No merged PRs in 30d

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dockur/windows

All issues in dockur/windows

Similar issues

More Shell/Bash issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.