Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.
Bug 1365708 - qemu-kvm gets SIGSEGV when attach a json backing image of ssh protocol
Summary: qemu-kvm gets SIGSEGV when attach a json backing image of ssh protocol
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.3
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Max Reitz
QA Contact: Ping Li
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-08-10 01:54 UTC by Han Han
Modified: 2018-03-22 03:30 UTC (History)
16 users (show)

Fixed In Version: 2.7.0
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 23:32:13 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2017:2392 0 normal SHIPPED_LIVE Important: qemu-kvm-rhev security, bug fix, and enhancement update 2017-08-01 20:04:36 UTC

Comment 3 Max Reitz 2016-08-12 13:29:28 UTC
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

Comment 7 Ping Li 2017-01-17 12:24:47 UTC
According to the comment 5, set the bug as verified.

Comment 9 errata-xmlrpc 2017-08-01 23:32:13 UTC
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

Comment 10 errata-xmlrpc 2017-08-02 01:09:52 UTC
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

Comment 11 errata-xmlrpc 2017-08-02 02:01:51 UTC
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

Comment 12 errata-xmlrpc 2017-08-02 02:42:37 UTC
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

Comment 13 errata-xmlrpc 2017-08-02 03:07:20 UTC
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

Comment 14 errata-xmlrpc 2017-08-02 03:27:29 UTC
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


Note You need to log in before you can comment on or make changes to this bug.