Bug 1588039 - Possible assertion failure in qemu when a corrupted image is used during an incoming migration
Summary: Possible assertion failure in qemu when a corrupted image is used during an i...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.6
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Max Reitz
QA Contact: Yumei Huang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-06-06 13:59 UTC by Max Reitz
Modified: 2018-11-08 08:27 UTC (History)
8 users (show)

Fixed In Version: qemu-kvm-rhev-2.12.0-5.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-11-01 11:10:24 UTC
Target Upstream Version:


Attachments (Terms of Use)
Compressed corrupted qcow2 image (292 bytes, application/x-xz)
2018-06-06 13:59 UTC, Max Reitz
no flags Details


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:3443 None None None 2018-11-01 11:12:36 UTC

Description Max Reitz 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


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