Red Hat Bugzilla – Bug 1365708
qemu-kvm gets SIGSEGV when attach a json backing image of ssh protocol
Last modified: 2018-03-21 23:30:20 EDT
Hi Han, The immediate issue here is that qemu's ssh driver expects the "port" argument to be an integer and not a string. So it should work if you replace "file.port":"22" by "file.port":22. The segfault itself is rather "safe" in that it will always only dereference NULL, so it can be used for DoS at most. However, it still is an issue that needs fixing, of course. The problem is that the type of options passed via -drive or JSON are not validated like options passed via blockdev-add are. However, many block drivers assume they are, including SSH. The issue can be reproduced even simpler like so: $ qemu-system-x86_64 -drive if=none,driver=ssh,host=foo,port=22 [1] 7996 segmentation fault (core dumped) qemu-system-x86_64 -drive if=none,driver=ssh,host=foo,port=22 This is because each value is treated as a string but ssh expects the port to be set to an integer. But the issue exists for other block drivers as well, e.g. NBD expects all of its arguments to be strings, so we can do this: $ qemu-img info "json:{'driver':'nbd', 'host':42}" [1] 7103 segmentation fault (core dumped) ./qemu-img info "json:{'driver':'nbd', 'host':42}" Or it will ignore a port specified as an integer: $ qemu-img info "json:{'driver':'nbd', 'host':'foo', 'port':42}" qemu-img: Could not open 'json:{'driver':'nbd', 'host':'foo', 'port':42}': address resolution failed for foo:10809: Name or service not known Which is better than crashing, admittedly, but not really good still. So because I do not consider this issue absolutely critical (it will always result in a NULL pointer getting dereferenced which is certain to result in a plain crash), because the fix will not be trivial, and because we're rather late in the release process, I'd rather move this BZ to 7.4. Max
According to the comment 5, set the bug as verified.
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. https://access.redhat.com/errata/RHSA-2017:2392