Bug 734860
| Summary: | qemu-kvm: segfault when missing host parameter for socket chardev | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 6 | Reporter: | Alon Levy <alevy> |
| Component: | qemu-kvm | Assignee: | Alon Levy <alevy> |
| Status: | CLOSED ERRATA | QA Contact: | Virtualization Bugs <virt-bugs> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 6.2 | CC: | dblechte, ehabkost, juzhang, mkenneth, tburke, virt-maint |
| Target Milestone: | rc | ||
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | qemu-kvm-0.12.1.2-2.187.el6 | Doc Type: | Bug Fix |
| Doc Text: |
Cause
missing NULL check.
Consequence
launching qemu-kvm with a socket chardev that is missing the host parameter crashes immediately.
Fix
add a NULL check.
Result
Forgetting the host parameter will cause an exit with appropriate error message.
|
Story Points: | --- |
| Clone Of: | Environment: | ||
| Last Closed: | 2011-12-06 15:58:44 UTC | Type: | --- |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 743047 | ||
Can reproduce with qemu-kvm-0.12.1.2-2.184.el6.x86_64,mark qa+
additional infos
#0 0x00000000004b99a8 in inet_listen_opts (opts=0x22550f0, port_offset=0) at qemu-sockets.c:149
#1 0x00000000004bdaca in qemu_chr_open_socket (opts=0x22550f0) at qemu-char.c:2333
#2 0x00000000004bb8ca in qemu_chr_open_opts (opts=0x22550f0, init=0) at qemu-char.c:2649
#3 0x00000000004096fb in chardev_init_func (opts=<value optimized out>, opaque=<value optimized out>)
at /usr/src/debug/qemu-kvm-0.12.1.2/vl.c:4584
#4 0x000000000047a28a in qemu_opts_foreach (list=<value optimized out>, func=0x4096f0 <chardev_init_func>, opaque=0x0,
abort_on_failure=<value optimized out>) at qemu-option.c:957
#5 0x000000000040cdc8 in main (argc=<value optimized out>, argv=<value optimized out>, envp=<value optimized out>)
at /usr/src/debug/qemu-kvm-0.12.1.2/vl.c:5860
Verified this issue with qemu-kvm-0.12.1.2-2.190.el6.x86_64 using comment0's steps. Results: inet_listen_opts: host and/or port not specified chardev: opening backend "socket" failed This issue has been fixed. adding technical notes.
Technical note added. If any revisions are required, please edit the "Technical Notes" field
accordingly. All revisions will be proofread by the Engineering Content Services team.
New Contents:
Cause
missing NULL check.
Consequence
launching qemu-kvm with a socket chardev that is missing the host parameter crashes immediately.
Fix
add a NULL check.
Result
Forgetting the host parameter will cause an exit with appropriate error message.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHSA-2011-1531.html |
commit d243a891612b7a938956e54e297247f0644a1a04 Author: Alon Levy <alevy> Date: Wed Aug 31 18:16:47 2011 +0300 qemu-socket: fix segfault if no host but port specified Issuing: qemu-system-x86_64 -chardev socket,port=7000,id=test,server,nowait Results in a segfault because of a NULL addr. Fix by testing for host parameter (like the existing error message says). diff --git a/qemu-sockets.c b/qemu-sockets.c index 23c3def..28034b2 100644 --- a/qemu-sockets.c +++ b/qemu-sockets.c @@ -130,7 +130,8 @@ int inet_listen_opts(QemuOpts *opts, int port_offset) ai.ai_family = PF_UNSPEC; ai.ai_socktype = SOCK_STREAM; - if (qemu_opt_get(opts, "port") == NULL) { + if (qemu_opt_get(opts, "host") == NULL || + qemu_opt_get(opts, "port") == NULL) { fprintf(stderr, "%s: host and/or port not specified\n", __FUNCTION__); return -1; }