qemu-cr16/include
Jie Song d6b9de8f9e monitor/qmp: cleanup SocketChardev listener sources early to avoid fd handling race
When starting a dummy QEMU process with virsh version, monitor_init_qmp()
enables IOThread monitoring of the QMP fd by default. However, a race
condition exists during the initialization phase: the IOThread only removes
the main thread's fd watch when it reaches qio_net_listener_set_client_func_full(),
which may be delayed under high system load.

This creates a window between monitor_qmp_setup_handlers_bh() and
qio_net_listener_set_client_func_full() where both the main thread and
IOThread are simultaneously monitoring the same fd and processing events.
This race can cause either the main thread or the IOThread to hang and
become unresponsive.

Fix this by proactively cleaning up the listener's IO sources in
monitor_init_qmp() before the IOThread initializes QMP monitoring,
ensuring exclusive fd ownership and eliminating the race condition.

Signed-off-by: Jie Song <songjie_yewu@cmss.chinamobile.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-ID: <20251125140706.114197-1-mail@jiesong.me>
(cherry picked from commit e714f1a3d4d1e66b9a3ff4be1ff999c32bbef29e)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2026-01-08 17:44:39 +03:00
..
accel accel/tcg: Add cpu_atomic_*_mmu for 16-byte xchg, fetch_and, fetch_or 2025-08-30 16:37:23 +01:00
authz
block hw/nvme: fix namespace atomic parameter setup 2025-11-25 09:21:35 +01:00
chardev monitor/qmp: cleanup SocketChardev listener sources early to avoid fd handling race 2026-01-08 17:44:39 +03:00
crypto crypto: support upto 5 parallel certificate identities 2025-11-03 10:45:55 +00:00
disas disas: Fix build against Capstone v6 (again) 2024-11-05 10:09:59 +00:00
exec exec/cpu: Declare cpu_memory_rw_debug() in 'hw/core/cpu.h' and document 2025-11-03 11:59:32 +01:00
fpu fpu: Move m68k_denormal fmt flag into floatx80_behaviour 2025-02-25 15:32:57 +00:00
gdbstub gdbstub/helpers: Replace TARGET_BIG_ENDIAN -> target_big_endian() 2025-07-15 02:56:39 -04:00
hw Revert "hw/net/virtio-net: make VirtIONet.vlans an array instead of a pointer" 2025-12-09 21:00:15 +01:00
io qio: Add QIONetListener API for using AioContext 2025-11-13 10:58:26 -06:00
libdecnumber include/libdecnumber: replace FSF postal address with licenses URL 2025-06-26 00:42:37 +02:00
migration Revert "migration/vmstate: remove VMSTATE_BUFFER_POINTER_UNSAFE macro" 2025-12-09 21:00:15 +01:00
monitor qdev: add qdev_find_default_bus() 2025-10-29 22:53:41 +04:00
net qom: remove redundant typedef when use OBJECT_DECLARE_SIMPLE_TYPE 2025-10-28 08:08:04 +01:00
qapi error: Kill @error_warn 2025-10-01 08:33:24 +02:00
qemu osdep: Undefine FSCALE definition to fix Solaris builds 2025-12-09 20:42:53 +01:00
qobject qobject: make refcount atomic 2025-10-28 13:02:26 +01:00
qom qom: reverse order of instance_post_init calls 2025-05-20 08:18:53 +02:00
scsi
semihosting include/semihosting/common-semi: extract common_semi API 2025-09-26 09:55:19 +01:00
standard-headers linux-headers: Update to Linux v6.18-rc3 2025-10-30 10:33:55 +08:00
system block: use pwrite_zeroes_alignment when writing first sector 2025-11-25 15:26:22 +01:00
tcg tcg/tci: Disable -Wundef FFI_GO_CLOSURES warning 2025-12-05 07:50:15 -06:00
ui ui/gtk: Add scale option 2025-07-15 10:22:33 +04:00
user accel/tcg: Add clear_flags argument to page_set_flags 2025-10-14 07:30:39 -07:00
elf.h elf: Add EF_MIPS_ARCH_ASE definitions 2025-09-02 17:57:05 +02:00
glib-compat.h include/glib-compat.h: Poison g_list_sort and g_slist_sort 2025-05-06 16:02:04 +02:00
qemu-io.h
qemu-main.h ui & main loop: Redesign of system-specific main thread event handling 2024-12-31 21:21:34 +01:00