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 1588039

Summary: Possible assertion failure in qemu when a corrupted image is used during an incoming migration
Product: Red Hat Enterprise Linux 7 Reporter: Hanna Czenczek <hreitz>
Component: qemu-kvm-rhevAssignee: Hanna Czenczek <hreitz>
Status: CLOSED ERRATA QA Contact: Yumei Huang <yuhuang>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.6CC: chayang, coli, jinzhao, juzhang, michen, ngu, virt-maint, yuhuang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-rhev-2.12.0-5.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-11-01 11:10:24 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:
Attachments:
Description Flags
Compressed corrupted qcow2 image none

Description Hanna Czenczek 2018-06-06 13:59:22 UTC
Created attachment 1448350 [details]
Compressed corrupted qcow2 image

Description of problem:

qemu’s qcow2 driver does not consider whether an image is inactive when marking it corrupt.  This results in an assertion failure because inactive images may not be written to.


Version-Release number of selected component (if applicable):

Upstream (2.12.50), and in RHV (qemu-kvm-rhev-2.12.0-3.el7).

(RHEL (1.5.3) is not directly affected because there is no assertion preventing writes to inactive disks.  We should not try to write to it anyway, but at least it does not cause a VM crash.)


How reproducible:

Always.


Steps to Reproduce:
1. Download the attached qcow2 file and place it in your working directory.
2. Execute the following:
$ echo -e 'qemu-io none0 "read 0 64k"\nquit' \
    | qemu-system-x86_64 -drive if=none,file=corrupted.qcow2 \
                         -monitor stdio \
                         -incoming exec:'cat /dev/null'

Actual results:

QEMU 2.12.0 monitor - type 'help' for more information
(qemu) qemu-io none0 "read 0 64k"
qcow2: Marking image as corrupt: L2 table offset 0x44200 unaligned (L1 index: 0); further corruption events will be suppressed
qemu-system-x86_64: block/io.c:1682: bdrv_co_pwritev: Assertion `!(bs->open_flags & BDRV_O_INACTIVE)' failed.
[1]    16427 done                 echo 'qemu-io none0 "read 0 64k"' | 
       16428 abort (core dumped)  qemu-system-x86_64 -drive if=none,file=corrupted.qcow2 -monito


Expected results:

QEMU 2.12.0 monitor - type 'help' for more information
(qemu) qemu-io none0 "read 0 64k"
qcow2: Image is corrupt: L2 table offset 0x44200 unaligned (L1 index: 0); further non-fatal corruption events will be suppressed
read failed: Input/output error
(qemu) quit

(The qcow2 driver does not try to mark the image corrupt (as if it were read-only), and thus, no crash occurs.)


Additional info:

Noticed in the logs for BZ 1583346.

Comment 3 Miroslav Rezanina 2018-06-25 14:19:30 UTC
Fix included in qemu-kvm-rhev-2.12.0-5.el7

Comment 5 Yumei Huang 2018-06-26 03:00:15 UTC
Reproduce:
qemu-kvm-rhev-2.12.0-4.el7
kernel-3.10.0-907.el7.x86_64

Download the attached qcow2 file, and run following command, qemu core dumped.

# echo -e 'qemu-io none0 "read 0 64k"\nquit' | /usr/libexec/qemu-kvm -drive if=none,file=corrupted.qcow2 -monitor stdio  -incoming exec:'cat /dev/null'

QEMU 2.12.0 monitor - type 'help' for more information
(qemu) VNC server running on ::1:5900
qemu-io none0 "read 0 64k"
qcow2: Marking image as corrupt: L2 table offset 0x44200 unaligned (L1 index: 0); further corruption events will be suppressed
qemu-kvm: block/io.c:1682: bdrv_co_pwritev: Assertion `!(bs->open_flags & 0x0800)' failed.
Aborted (core dumped)


Verify:
qemu-kvm-rhev-2.12.0-5.el7
kernel-3.10.0-907.el7.x86_64

With same steps, qemu quit without core dump.

# echo -e 'qemu-io none0 "read 0 64k"\nquit' | /usr/libexec/qemu-kvm -drive if=none,file=corrupted.qcow2 -monitor stdio  -incoming exec:'cat /dev/null'

QEMU 2.12.0 monitor - type 'help' for more information
(qemu) VNC server running on ::1:5900
qemu-io none0 "read 0 64k"
qcow2: Image is corrupt: L2 table offset 0x44200 unaligned (L1 index: 0); further non-fatal corruption events will be suppressed
read failed: Input/output error
(qemu) quit

Comment 6 errata-xmlrpc 2018-11-01 11:10:24 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/RHBA-2018:3443