Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1601310 - qemu-img map 'Aborted (core dumped)' when specifying a plain file
Summary: qemu-img map 'Aborted (core dumped)' when specifying a plain file
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
medium
high
Target Milestone: rc
: ---
Assignee: Max Reitz
QA Contact: Tingting Mao
URL:
Whiteboard:
: 1590024 (view as bug list)
Depends On:
Blocks: 1639374
TreeView+ depends on / blocked
 
Reported: 2018-07-16 03:33 UTC by Tingting Mao
Modified: 2018-11-01 11:15 UTC (History)
12 users (show)

Fixed In Version: qemu-kvm-rhev-2.12.0-10.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1639374 (view as bug list)
Environment:
Last Closed: 2018-11-01 11:13:00 UTC
Target Upstream Version:


Attachments (Terms of Use)
gdb backtrace (deleted)
2018-07-16 03:33 UTC, Tingting Mao
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:15:19 UTC

Description Tingting Mao 2018-07-16 03:33:54 UTC
Created attachment 1459048 [details]
gdb backtrace

Description of problem:
The command "qemu-img map" results in 'core dumped' when specifying the tested file which is a plain file (i.e. not qcow2/raw image).

Version-Release number of selected component (if applicable):
qemu-kvm-rhev-2.12.0-7.el7
kernel-3.10.0-919.el7

How reproducible:
3/3

Steps to Reproduce:
1.Create a plain file
# cat test
ttttttttttt
tttttttt
2.Dump the metadata
# qemu-img map test 
Offset          Length          Mapped to       File
qemu-img: qemu-img.c:2765: get_block_status: Assertion `bytes' failed.
Aborted (core dumped)

Actual results:

Expected results:
No core dumped, and the metadata should be dumped successfully.


Additional info:
1.The result is expected in rhel7.5, so I think it should be a regression. And more details are listed below.

Tested packages:
qemu-kvm-rhev-2.10.0-21.el7_5.1
kernel-3.10.0-862.el7

Steps:
1.1 Create one plain file
# cat test 
tttttttttt

sssssss
1.2 Dump metadata of the file
# qemu-img map test 
Offset          Length          Mapped to       File
0               0x200           0               test
# qemu-img map test --output=json
[{ "start": 0, "length": 512, "depth": 0, "zero": false, "data": true, "offset": 0}]


2. It is successful to dump metadata for a qcow2/raw image file
Tested packages:
qemu-kvm-rhev-2.12.0-7.el7
kernel-3.10.0-919.el7

Steps:
2.1 # qemu-img create -f qcow2 base.qcow2 1G
Formatting 'base.qcow2', fmt=qcow2 size=1073741824 cluster_size=65536 lazy_refcounts=off refcount_bits=16
2.2 # qemu-io -c 'write 0 200M' base.qcow2 
wrote 209715200/209715200 bytes at offset 0
200 MiB, 1 ops; 0.1861 sec (1.049 GiB/sec and 5.3720 ops/sec)
2.3 # qemu-img map base.qcow2 
Offset          Length          Mapped to       File
0               0xc800000       0x50000         base.qcow2

Comment 3 Max Reitz 2018-08-06 16:07:00 UTC
Fixed upstream, the commit (e0b371ed5e2db079051139136fd0478728b6a58f) mentions BZ 1589738.

Comment 5 Eric Blake 2018-08-06 20:40:35 UTC
bug 1613046 is tangentially related as another place where qemu has shortcomings dealing with a non-aligned raw file.

Comment 6 Miroslav Rezanina 2018-08-10 10:44:43 UTC
Fix included in qemu-kvm-rhev-2.12.0-10.el7

Comment 8 Tingting Mao 2018-08-14 03:26:35 UTC
Verify this issue like below:

Tested packages:
qemu-kvm-rhev-2.12.0-10.el7
kernel-3.10.0-931.el7

Scenario1
1.Find one temporary file
# cat test 
xxxxxxxxxxxxxxxx

xxxxxxxxxxxxxxxxxxx
2.dump the metadata for the file, it works!
2.1 dump with human/default format
# qemu-img map test 
Offset          Length          Mapped to       File
0               0x26            0               test
2.2 dump with json format
# qemu-img map test --output=json
[{ "start": 0, "length": 38, "depth": 0, "zero": false, "data": true, "offset": 0},
{ "start": 38, "length": 474, "depth": 0, "zero": true, "data": false, "offset": 38}]


Scenario2
1. Get the source code
# brew download-build --rpm --arch=x86_64 qemu-kvm-rhev-2.12.0-10.el7.src.rpm
# rpm -ivhf qemu-kvm-rhev-2.12.0-10.el7.src.rpm
# rpmbuild -bp /root/rpmbuild/SPECS/qemu-kvm.spec --nodeps 
2. configure the env
# cd /root/rpmbuild/BUILD/qemu-2.12.0/
# ./configure 
# export QEMU_PROG=/usr/libexec/qemu-kvm
# export QEMU_IMG_PROG=/usr/bin/qemu-img
# export QEMU_IO_PROG=/usr/bin/qemu-io
# export QEMU_NBD_PROG=/usr/bin/qemu-nbd
3. test the 221th case
# cd tests/qemu-iotests/
# ./check -raw 221
QEMU          -- "/usr/libexec/qemu-kvm" -nodefaults -machine accel=qtest
QEMU_IMG      -- "/usr/bin/qemu-img" 
QEMU_IO       -- "/usr/bin/qemu-io"  --cache writeback -f raw
QEMU_NBD      -- "/usr/bin/qemu-nbd" 
IMGFMT        -- raw
IMGPROTO      -- file
PLATFORM      -- Linux/x86_64 lenovo-sr630-01 3.10.0-931.el7.x86_64
TEST_DIR      -- /root/rpmbuild/BUILD/qemu-2.12.0/tests/qemu-iotests/scratch
SOCKET_SCM_HELPER -- 

221 0s ...
Passed all 1 tests

Comment 9 Eric Blake 2018-08-21 12:30:47 UTC
*** Bug 1590024 has been marked as a duplicate of this bug. ***

Comment 10 errata-xmlrpc 2018-11-01 11:13:00 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.