qmp/hmp: crash if client closes socket too early
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
QEMU |
Expired
|
Undecided
|
Unassigned |
Bug Description
Qemu crashes on qmp/hmp command if client closes connection before reading the whole response from the socket.
Reproducer:
1. Start arbitrary vm via qemu
2. Send e.g. hmp command 'info mem'
3. Abort before whole response came back
Stack Trace:
Stack trace of thread 6493:
#0 0x0000559902fd2d30 object_get_class (qemu-system-
#1 0x0000559903071020 qio_channel_
#2 0x000055990305f437 qemu_chr_
#3 0x0000559902f7340d monitor_
#4 0x0000559902f7360e monitor_
#5 0x0000559902f74342 qmp_send_response (qemu-system-
#6 0x0000559902f74409 monitor_qmp_respond (qemu-system-
#7 0x0000559902f74bc0 monitor_
#8 0x00005599030c37be aio_bh_call (qemu-system-
#9 0x00005599030c6dd0 aio_dispatch (qemu-system-
#10 0x00005599030c369e aio_ctx_dispatch (qemu-system-
#11 0x00007f5b6d37f417 g_main_
#12 0x00005599030c5e0a glib_pollfds_poll (qemu-system-
#13 0x0000559902dd75df main_loop (qemu-system-
#14 0x0000559902c59f49 main (qemu-system-
#15 0x00007f5b6bfeab97 __libc_start_main (libc.so.6)
#16 0x0000559902c5d38a _start (qemu-system-
#0 0x0000559902fd2d30 in object_get_class (obj=obj@entry=0x0) at ./qom/object.c:909
#1 0x0000559903071020 in qio_channel_
klass = <optimized out>
__func__ = "qio_channel_
ret = <optimized out>
#2 0x000055990305f437 in qemu_chr_
s = 0x5599055782c0
src = <optimized out>
tag = <optimized out>
__func__ = "qemu_chr_
#3 0x0000559902f7340d in monitor_
rc = 219264
len = 3865832
buf = 0x7f5afc00e480 "{\"return\": \"ffff9eb480000
#4 0x0000559902f7360e in monitor_
i = 3865830
c = <optimized out>
#5 0x0000559902f7360e in monitor_puts (mon=mon@
i = 3865830
c = <optimized out>
#6 0x0000559902f74342 in qmp_send_response (mon=0x559905a7
data = <optimized out>
json = 0x559906c88380
#7 0x0000559902f74409 in monitor_qmp_respond (rsp=0x559905bb
old_mon = <optimized out>
rsp = 0x559905bbf740
error = <optimized out>
#8 0x0000559902f74409 in monitor_
old_mon = <optimized out>
rsp = 0x559905bbf740
error = <optimized out>
#9 0x0000559902f74bc0 in monitor_
id = <optimized out>
rsp = <optimized out>
need_resume = true
mon = 0x559905a7f460
#10 0x00005599030c37be in aio_bh_call (bh=0x559905571b40) at ./util/async.c:89
bh = 0x559905571b40
bhp = <optimized out>
next = 0x5599055718f0
ret = 1
deleted = false
#11 0x00005599030c37be in aio_bh_poll (ctx=ctx@
bh = 0x559905571b40
bhp = <optimized out>
next = 0x5599055718f0
ret = 1
deleted = false
#12 0x00005599030c6dd0 in aio_dispatch (ctx=0x55990557
#13 0x00005599030c369e in aio_ctx_dispatch (source=<optimized out>, callback=<optimized out>, user_data=
ctx = <optimized out>
#14 0x00007f5b6d37f417 in g_main_
#15 0x00005599030c5e0a in glib_pollfds_poll () at ./util/
context = 0x559905652420
pfds = <optimized out>
context = 0x559905652420
ret = 1
mlpoll = {state = 0, timeout = 4294967295, pollfds = 0x559905651800}
#16 0x00005599030c5e0a in os_host_
context = 0x559905652420
ret = 1
mlpoll = {state = 0, timeout = 4294967295, pollfds = 0x559905651800}
#17 0x00005599030c5e0a in main_loop_wait (nonblocking=
mlpoll = {state = 0, timeout = 4294967295, pollfds = 0x559905651800}
#18 0x0000559902dd75df in main_loop () at ./vl.c:1810
#19 0x0000559902c59f49 in main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at ./vl.c:4466
i = <optimized out>
snapshot = 0
linux_boot = <optimized out>
boot_order = 0x55990318bc94 "cad"
boot_once = <optimized out>
ds = <optimized out>
opts = <optimized out>
icount_opts = <optimized out>
accel_opts = 0x0
olist = <optimized out>
optind = 100
optarg = 0x7ffe0ca05e74 "timestamp=on"
loadvm = 0x0
cpu_option = 0x7ffe0ca05d42 "SandyBridge-
vga_model = 0x0
qtest_log = 0x0
incoming = 0x0
userconfig = <optimized out>
nographic = false
log_mask = <optimized out>
log_file = 0x0
trace_file = <optimized out>
maxram_size = <optimized out>
ram_slots = 0
err = 0x0
dirs = <optimized out>
bdo_queue = {sqh_first = 0x0, sqh_last = 0x7ffe0ca03540}
plugin_list = {tqh_first = 0x0, tqh_circ = {tql_next = 0x0, tql_prev = 0x7ffe0ca03550}}
__func__ = "main"
The QEMU project is currently moving its bug tracking to another system.
For this we need to know which bugs are still valid and which could be
closed already. Thus we are setting the bug state to "Incomplete" now.
If the bug has already been fixed in the latest upstream version of QEMU,
then please close this ticket as "Fix released".
If it is not fixed yet and you think that this bug report here is still
valid, then you have two options:
1) If you already have an account on gitlab.com, please open a new ticket
for this problem in our new tracker here:
https:/ /gitlab. com/qemu- project/ qemu/-/ issues
and then close this ticket here on Launchpad (or let it expire auto-
matically after 60 days). Please mention the URL of this bug ticket on
Launchpad in the new ticket on GitLab.
2) If you don't have an account on gitlab.com and don't intend to get
one, but still would like to keep this ticket opened, then please switch
the state back to "New" or "Confirmed" within the next 60 days (other-
wise it will get closed as "Expired"). We will then eventually migrate
the ticket automatically to the new system (but you won't be the reporter
of the bug in the new system and thus you won't get notified on changes
anymore).
Thank you and sorry for the inconvenience.