Bug 1451849 - qemu-img convert crashes on error
Summary: qemu-img convert crashes on error
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Kevin Wolf
QA Contact: Ping Li
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-05-17 16:08 UTC by Kevin Wolf
Modified: 2018-03-22 05:19 UTC (History)
7 users (show)

Fixed In Version: qemu-kvm-rhev-2.9.0-7.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-02 04:38:29 UTC


Attachments (Terms of Use)


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

Description Kevin Wolf 2017-05-17 16:08:42 UTC
When an error occurs during qemu-img convert, several use-after-free errors can
happen which may cause qemu to crash. The problem has been fixed upstream with
commit b91127edd ('qemu-img: wait for convert coroutines to complete') and is
proposed for qemu-stable.

In my own testing, I could not quickly reproduce actual crashes, but using
valgrind I could see errors without the patch. For reproduction, I used a
blkdebug configuration file that would inject a write error after a while:

[inject-error]
event = "write_aio"
sector = "819200"
once = "on"

The test run was performed with a command line like this (note that using
blkdebug as the target requires that an image of the correct size is manually
created and -n is used):

$ valgrind qemu-img convert -npWO qcow2 $SOURCE blkdebug:/tmp/blkdebug.conf:/tmp/test.qcow2

Expected result:
No valgrind errors are reported:
==2576== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

Actual result:
Valgrind does report errors:
==2657== ERROR SUMMARY: 8 errors from 2 contexts (suppressed: 0 from 0)

Comment 1 Miroslav Rezanina 2017-05-30 15:03:39 UTC
Fix included in qemu-kvm-rhev-2.9.0-7.el7

Comment 2 Ping Li 2017-06-01 14:03:11 UTC
Test steps:
#wget http://www.valgrind.org/downloads/valgrind-3.12.0.tar.bz2
#tar -jxvf valgrind-3.12.0.tar.bz2
#cd valgrind-3.12.0
#./autogen.sh
#./configure
#make && make install
# cat >> /home/blkdebug.cfg << eof
[inject-error]
event = "write_aio"
sector = "819200"
once = "on"
eof
#qemu-img create -f qcow2 /home/source.qcow2 1G
#qemu-img create -f qcow2 /home/target.qcow2 1G
#qemu-io -c 'write 0 1G' source.qcow2
#valgrind qemu-img convert -npWO qcow2 source.qcow2 blkdebug:/home/blkdebug.cfg:/home/target.qcow2


Reproduced the issue with below packages:
kernel-3.10.0-669.el7
qemu-kvm-rhev-2.9.0-5.el7
test result:
==4108== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)

Verified the issue with below packages:
kernel-3.10.0-675.el7
qemu-kvm-rhev-2.9.0-7.el7
test result:
==28177== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

Comment 3 CongLi 2017-06-02 02:08:18 UTC
Based on comment 2, set this bug to 'VERIFIED'.

Thanks.

Comment 5 errata-xmlrpc 2017-08-02 04:38: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.