Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1451849

Summary: qemu-img convert crashes on error
Product: Red Hat Enterprise Linux 7 Reporter: Kevin Wolf <kwolf>
Component: qemu-kvm-rhevAssignee: Kevin Wolf <kwolf>
Status: CLOSED ERRATA QA Contact: Ping Li <pingl>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4CC: aliang, chayang, coli, juzhang, knoel, michen, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-rhev-2.9.0-7.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-02 04:38:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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