All of lore.kernel.org
 help / color / mirror / Atom feed
* qemu-img convert asserts while converting from vhdx to raw
@ 2020-07-28 16:53 Swapnil Ingle
  2020-07-29 10:56 ` Max Reitz
  0 siblings, 1 reply; 3+ messages in thread
From: Swapnil Ingle @ 2020-07-28 16:53 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 4217 bytes --]

Hey Guys,

We are seeing following assert when trying to convert disk image from vhdx to raw.
This issue is seen only for disk with 4k logical sector size.

$ qemu-img convert -f vhdx -O raw 4KTest1.vhdx test.raw
qemu-img: util/iov.c:388: qiov_slice: Assertion `offset + len <= qiov->size' failed.
Aborted

$ qemu-img --version
qemu-img version 5.0.91 (v5.1.0-rc1-2-g3cbc897-dirty)
Copyright (c) 2003-2020 Fabrice Bellard and the QEMU Project developers

 $ qemu-img check -r all 4KTest1.vhdx
No errors were found on the image.

$ qemu-img info 4KTest1.vhdx
image: 4KTest1.vhdx
file format: vhdx
virtual size: 10 GiB (10737418240 bytes)
disk size: 35.7 GiB
cluster_size: 33554432

The vhdx disk metadata is following,

VhdFormat : VHDX
VhdType : Dynamic
LogicalSectorSize : 4096
PhysicalSectorSize : 4096
BlockSize : 33554432

Following is the backtrace of the assert,

#0  0x00007ffff64cf387 in raise () from /lib64/libc.so.6
#1  0x00007ffff64d0a78 in abort () from /lib64/libc.so.6
#2  0x00007ffff64c81a6 in __assert_fail_base () from /lib64/libc.so.6
#3  0x00007ffff64c8252 in __assert_fail () from /lib64/libc.so.6
#4  0x00005555556abf5a in qiov_slice (qiov=0x7ffff4122a20, offset=0, len=2096640, head=0x7ffff4122648, tail=0x7ffff4122650,
    niov=0x7ffff4122640) at util/iov.c:388
#5  0x00005555556ac0f6 in qemu_iovec_init_extended (qiov=0x7ffff4122730, head_buf=0x0, head_len=0, mid_qiov=0x7ffff4122a20, mid_offset=0,
    mid_len=2096640, tail_buf=0x0, tail_len=0) at util/iov.c:429
#6  0x00005555556ac438 in qemu_iovec_init_slice (qiov=0x7ffff4122730, source=0x7ffff4122a20, offset=0, len=2096640) at util/iov.c:495
#7  0x0000555555609bd6 in bdrv_driver_preadv (bs=0x555555982a80, offset=15841886208, bytes=2096640, qiov=0x7ffff4122a20, qiov_offset=0,
    flags=0) at block/io.c:1134
#8  0x000055555560ad55 in bdrv_aligned_preadv (child=0x5555559891f0, req=0x7ffff4122900, offset=15841886208, bytes=2096640, align=1,
    qiov=0x7ffff4122a20, qiov_offset=0, flags=0) at block/io.c:1515
#9  0x000055555560b67b in bdrv_co_preadv_part (child=0x5555559891f0, offset=15841886208, bytes=2096640, qiov=0x7ffff4122a20, qiov_offset=0,
    flags=0) at block/io.c:1756
#10 0x000055555560b4b4 in bdrv_co_preadv (child=0x5555559891f0, offset=15841886208, bytes=2096640, qiov=0x7ffff4122a20, flags=0)
    at block/io.c:1714
#11 0x00005555555e3266 in vhdx_co_readv (bs=0x55555597b370, sector_num=4194304, nb_sectors=4095, qiov=0x7ffff4122e10) at block/vhdx.c:1208
#12 0x0000555555609da1 in bdrv_driver_preadv (bs=0x55555597b370, offset=2147483136, bytes=2097152, qiov=0x7ffff4122e10, qiov_offset=0,
    flags=0) at block/io.c:1169
#13 0x000055555560ad55 in bdrv_aligned_preadv (child=0x555555989150, req=0x7ffff4122cb0, offset=2147483136, bytes=2097152, align=512,
    qiov=0x7ffff4122e10, qiov_offset=0, flags=0) at block/io.c:1515
#14 0x000055555560b67b in bdrv_co_preadv_part (child=0x555555989150, offset=2147483136, bytes=2097152, qiov=0x7ffff4122e10, qiov_offset=0,
    flags=0) at block/io.c:1756
#15 0x000055555560b4b4 in bdrv_co_preadv (child=0x555555989150, offset=2147483136, bytes=2097152, qiov=0x7ffff4122e10, flags=0)
    at block/io.c:1714
#16 0x00005555555f34c3 in blk_do_preadv (blk=0x55555597b010, offset=2147483136, bytes=2097152, qiov=0x7ffff4122e10, flags=0)
    at block/block-backend.c:1211
#17 0x00005555555f351b in blk_co_preadv (blk=0x55555597b010, offset=2147483136, bytes=2097152, qiov=0x7ffff4122e10, flags=0)
    at block/block-backend.c:1223
#18 0x000055555557347b in blk_co_pread (blk=0x55555597b010, offset=2147483136, bytes=2097152, buf=0x7fffefdff000, flags=0)
    at /home/swapnil/dev/github/qemu/include/sysemu/block-backend.h:140
#19 0x00005555555771aa in convert_co_read (s=0x7fffffffdc30, sector_num=4194303, nb_sectors=4096, buf=0x7fffefdff000 "") at qemu-img.c:1830
#20 0x000055555557785c in convert_co_do_copy (opaque=0x7fffffffdc30) at qemu-img.c:2007
#21 0x00005555556a9e4e in coroutine_trampoline (i0=1436133568, i1=21845) at util/coroutine-ucontext.c:173
#22 0x00007ffff64e1190 in ?? () from /lib64/libc.so.6
#23 0x00007fffffffd2e0 in ?? ()
#24 0x0000000000000000 in ?? ()

Thanks and Regards,
-Swapnil


[-- Attachment #2: Type: text/html, Size: 18777 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: qemu-img convert asserts while converting from vhdx to raw
  2020-07-28 16:53 qemu-img convert asserts while converting from vhdx to raw Swapnil Ingle
@ 2020-07-29 10:56 ` Max Reitz
  2020-08-05 15:54   ` Swapnil Ingle
  0 siblings, 1 reply; 3+ messages in thread
From: Max Reitz @ 2020-07-29 10:56 UTC (permalink / raw)
  To: Swapnil Ingle, qemu-devel, Qemu-block, Jeff Cody


[-- Attachment #1.1: Type: text/plain, Size: 5435 bytes --]

On 28.07.20 18:53, Swapnil Ingle wrote:
> Hey Guys,
> 
>  
> 
> We are seeing following assert when trying to convert disk image from
> vhdx to raw. 
> 
> This issue is seen only for disk with 4k logical sector size.

Honestly, looking at the vhdx code, it just can’t work for 4k logical
sectors without a major rework.  As far as I can see, for some reason it
likes to assume that qemu block layer sectors (which are always 512
bytes) are always the same as vhdx sectors (which aren’t).

Did you ever get any vhdx image with 4k logical sectors to work?

The problem I see is that we don’t have an active maintainer for vhdx,
so as unfortunate as it is, if it’s really never worked, the only
realistic solution I see would be to outright refuse to open images with
4k sectors...

Max

> $ qemu-img convert -f vhdx -O raw 4KTest1.vhdx test.raw
> 
> qemu-img: util/iov.c:388: qiov_slice: Assertion `offset + len <=
> qiov->size' failed.
> 
> Aborted
> 
>  
> 
> $ qemu-img --version
> 
> qemu-img version 5.0.91 (v5.1.0-rc1-2-g3cbc897-dirty)
> 
> Copyright (c) 2003-2020 Fabrice Bellard and the QEMU Project developers
> 
>  
> 
>  $ qemu-img check -r all 4KTest1.vhdx
> 
> No errors were found on the image.
> 
>  
> 
> $ qemu-img info 4KTest1.vhdx
> 
> image: 4KTest1.vhdx
> 
> file format: vhdx
> 
> virtual size: 10 GiB (10737418240 bytes)
> 
> disk size: 35.7 GiB
> 
> cluster_size: 33554432
> 
>  
> 
> The vhdx disk metadata is following, 
> 
>  
> 
> VhdFormat : VHDX
> 
> VhdType : Dynamic
> 
> LogicalSectorSize : 4096 
> 
> PhysicalSectorSize : 4096
> 
> BlockSize : 33554432
> 
>  
> 
> Following is the backtrace of the assert, 
> 
>  
> 
> #0  0x00007ffff64cf387 in raise () from /lib64/libc.so.6
> 
> #1  0x00007ffff64d0a78 in abort () from /lib64/libc.so.6
> 
> #2  0x00007ffff64c81a6 in __assert_fail_base () from /lib64/libc.so.6
> 
> #3  0x00007ffff64c8252 in __assert_fail () from /lib64/libc.so.6
> 
> #4  0x00005555556abf5a in qiov_slice (qiov=0x7ffff4122a20, offset=0,
> len=2096640, head=0x7ffff4122648, tail=0x7ffff4122650,
> 
>     niov=0x7ffff4122640) at util/iov.c:388
> 
> #5  0x00005555556ac0f6 in qemu_iovec_init_extended (qiov=0x7ffff4122730,
> head_buf=0x0, head_len=0, mid_qiov=0x7ffff4122a20, mid_offset=0,
> 
>     mid_len=2096640, tail_buf=0x0, tail_len=0) at util/iov.c:429
> 
> #6  0x00005555556ac438 in qemu_iovec_init_slice (qiov=0x7ffff4122730,
> source=0x7ffff4122a20, offset=0, len=2096640) at util/iov.c:495
> 
> #7  0x0000555555609bd6 in bdrv_driver_preadv (bs=0x555555982a80,
> offset=15841886208, bytes=2096640, qiov=0x7ffff4122a20, qiov_offset=0,
> 
>     flags=0) at block/io.c:1134
> 
> #8  0x000055555560ad55 in bdrv_aligned_preadv (child=0x5555559891f0,
> req=0x7ffff4122900, offset=15841886208, bytes=2096640, align=1,
> 
>     qiov=0x7ffff4122a20, qiov_offset=0, flags=0) at block/io.c:1515
> 
> #9  0x000055555560b67b in bdrv_co_preadv_part (child=0x5555559891f0,
> offset=15841886208, bytes=2096640, qiov=0x7ffff4122a20, qiov_offset=0,
> 
>     flags=0) at block/io.c:1756
> 
> #10 0x000055555560b4b4 in bdrv_co_preadv (child=0x5555559891f0,
> offset=15841886208, bytes=2096640, qiov=0x7ffff4122a20, flags=0)
> 
>     at block/io.c:1714
> 
> #11 0x00005555555e3266 in vhdx_co_readv (bs=0x55555597b370,
> sector_num=4194304, nb_sectors=4095, qiov=0x7ffff4122e10) at
> block/vhdx.c:1208
> 
> #12 0x0000555555609da1 in bdrv_driver_preadv (bs=0x55555597b370,
> offset=2147483136, bytes=2097152, qiov=0x7ffff4122e10, qiov_offset=0,
> 
>     flags=0) at block/io.c:1169
> 
> #13 0x000055555560ad55 in bdrv_aligned_preadv (child=0x555555989150,
> req=0x7ffff4122cb0, offset=2147483136, bytes=2097152, align=512,
> 
>     qiov=0x7ffff4122e10, qiov_offset=0, flags=0) at block/io.c:1515
> 
> #14 0x000055555560b67b in bdrv_co_preadv_part (child=0x555555989150,
> offset=2147483136, bytes=2097152, qiov=0x7ffff4122e10, qiov_offset=0,
> 
>     flags=0) at block/io.c:1756
> 
> #15 0x000055555560b4b4 in bdrv_co_preadv (child=0x555555989150,
> offset=2147483136, bytes=2097152, qiov=0x7ffff4122e10, flags=0)
> 
>     at block/io.c:1714
> 
> #16 0x00005555555f34c3 in blk_do_preadv (blk=0x55555597b010,
> offset=2147483136, bytes=2097152, qiov=0x7ffff4122e10, flags=0)
> 
>     at block/block-backend.c:1211
> 
> #17 0x00005555555f351b in blk_co_preadv (blk=0x55555597b010,
> offset=2147483136, bytes=2097152, qiov=0x7ffff4122e10, flags=0)
> 
>     at block/block-backend.c:1223
> 
> #18 0x000055555557347b in blk_co_pread (blk=0x55555597b010,
> offset=2147483136, bytes=2097152, buf=0x7fffefdff000, flags=0)
> 
>     at /home/swapnil/dev/github/qemu/include/sysemu/block-backend.h:140
> 
> #19 0x00005555555771aa in convert_co_read (s=0x7fffffffdc30,
> sector_num=4194303, nb_sectors=4096, buf=0x7fffefdff000 "") at
> qemu-img.c:1830
> 
> #20 0x000055555557785c in convert_co_do_copy (opaque=0x7fffffffdc30) at
> qemu-img.c:2007
> 
> #21 0x00005555556a9e4e in coroutine_trampoline (i0=1436133568, i1=21845)
> at util/coroutine-ucontext.c:173
> 
> #22 0x00007ffff64e1190 in ?? () from /lib64/libc.so.6
> 
> #23 0x00007fffffffd2e0 in ?? ()
> 
> #24 0x0000000000000000 in ?? ()
> 
>  
> 
> Thanks and Regards,
> 
> -Swapnil
> 
>  
> 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: qemu-img convert asserts while converting from vhdx to raw
  2020-07-29 10:56 ` Max Reitz
@ 2020-08-05 15:54   ` Swapnil Ingle
  0 siblings, 0 replies; 3+ messages in thread
From: Swapnil Ingle @ 2020-08-05 15:54 UTC (permalink / raw)
  To: Max Reitz; +Cc: Jeff Cody, qemu-devel, Qemu-block

Hi Max,

Thanks for the response.

I checked internally and looks like it always fails.
Also in the code I see comment saying "We only support 512 currently"
at block/vhdx.c: vhdx_parse_metadata()

As you suggested we can just refuse to open images with 4K logical sector size, 
I will send an patch fixing this.

Thanks and Regards,
-Swapnil

On 29.07.20, 12:56, "Max Reitz" <mreitz@redhat.com> wrote:

    On 28.07.20 18:53, Swapnil Ingle wrote:
    > Hey Guys,
    > 
    >  
    > 
    > We are seeing following assert when trying to convert disk image from
    > vhdx to raw. 
    > 
    > This issue is seen only for disk with 4k logical sector size.

    Honestly, looking at the vhdx code, it just can’t work for 4k logical
    sectors without a major rework.  As far as I can see, for some reason it
    likes to assume that qemu block layer sectors (which are always 512
    bytes) are always the same as vhdx sectors (which aren’t).

    Did you ever get any vhdx image with 4k logical sectors to work?

    The problem I see is that we don’t have an active maintainer for vhdx,
    so as unfortunate as it is, if it’s really never worked, the only
    realistic solution I see would be to outright refuse to open images with
    4k sectors...

    Max

    > $ qemu-img convert -f vhdx -O raw 4KTest1.vhdx test.raw
    > 
    > qemu-img: util/iov.c:388: qiov_slice: Assertion `offset + len <=
    > qiov->size' failed.
    > 
    > Aborted
    > 
    >  
    > 
    > $ qemu-img --version
    > 
    > qemu-img version 5.0.91 (v5.1.0-rc1-2-g3cbc897-dirty)
    > 
    > Copyright (c) 2003-2020 Fabrice Bellard and the QEMU Project developers
    > 
    >  
    > 
    >  $ qemu-img check -r all 4KTest1.vhdx
    > 
    > No errors were found on the image.
    > 
    >  
    > 
    > $ qemu-img info 4KTest1.vhdx
    > 
    > image: 4KTest1.vhdx
    > 
    > file format: vhdx
    > 
    > virtual size: 10 GiB (10737418240 bytes)
    > 
    > disk size: 35.7 GiB
    > 
    > cluster_size: 33554432
    > 
    >  
    > 
    > The vhdx disk metadata is following, 
    > 
    >  
    > 
    > VhdFormat : VHDX
    > 
    > VhdType : Dynamic
    > 
    > LogicalSectorSize : 4096 
    > 
    > PhysicalSectorSize : 4096
    > 
    > BlockSize : 33554432
    > 
    >  
    > 
    > Following is the backtrace of the assert, 
    > 
    >  
    > 
    > #0  0x00007ffff64cf387 in raise () from /lib64/libc.so.6
    > 
    > #1  0x00007ffff64d0a78 in abort () from /lib64/libc.so.6
    > 
    > #2  0x00007ffff64c81a6 in __assert_fail_base () from /lib64/libc.so.6
    > 
    > #3  0x00007ffff64c8252 in __assert_fail () from /lib64/libc.so.6
    > 
    > #4  0x00005555556abf5a in qiov_slice (qiov=0x7ffff4122a20, offset=0,
    > len=2096640, head=0x7ffff4122648, tail=0x7ffff4122650,
    > 
    >     niov=0x7ffff4122640) at util/iov.c:388
    > 
    > #5  0x00005555556ac0f6 in qemu_iovec_init_extended (qiov=0x7ffff4122730,
    > head_buf=0x0, head_len=0, mid_qiov=0x7ffff4122a20, mid_offset=0,
    > 
    >     mid_len=2096640, tail_buf=0x0, tail_len=0) at util/iov.c:429
    > 
    > #6  0x00005555556ac438 in qemu_iovec_init_slice (qiov=0x7ffff4122730,
    > source=0x7ffff4122a20, offset=0, len=2096640) at util/iov.c:495
    > 
    > #7  0x0000555555609bd6 in bdrv_driver_preadv (bs=0x555555982a80,
    > offset=15841886208, bytes=2096640, qiov=0x7ffff4122a20, qiov_offset=0,
    > 
    >     flags=0) at block/io.c:1134
    > 
    > #8  0x000055555560ad55 in bdrv_aligned_preadv (child=0x5555559891f0,
    > req=0x7ffff4122900, offset=15841886208, bytes=2096640, align=1,
    > 
    >     qiov=0x7ffff4122a20, qiov_offset=0, flags=0) at block/io.c:1515
    > 
    > #9  0x000055555560b67b in bdrv_co_preadv_part (child=0x5555559891f0,
    > offset=15841886208, bytes=2096640, qiov=0x7ffff4122a20, qiov_offset=0,
    > 
    >     flags=0) at block/io.c:1756
    > 
    > #10 0x000055555560b4b4 in bdrv_co_preadv (child=0x5555559891f0,
    > offset=15841886208, bytes=2096640, qiov=0x7ffff4122a20, flags=0)
    > 
    >     at block/io.c:1714
    > 
    > #11 0x00005555555e3266 in vhdx_co_readv (bs=0x55555597b370,
    > sector_num=4194304, nb_sectors=4095, qiov=0x7ffff4122e10) at
    > block/vhdx.c:1208
    > 
    > #12 0x0000555555609da1 in bdrv_driver_preadv (bs=0x55555597b370,
    > offset=2147483136, bytes=2097152, qiov=0x7ffff4122e10, qiov_offset=0,
    > 
    >     flags=0) at block/io.c:1169
    > 
    > #13 0x000055555560ad55 in bdrv_aligned_preadv (child=0x555555989150,
    > req=0x7ffff4122cb0, offset=2147483136, bytes=2097152, align=512,
    > 
    >     qiov=0x7ffff4122e10, qiov_offset=0, flags=0) at block/io.c:1515
    > 
    > #14 0x000055555560b67b in bdrv_co_preadv_part (child=0x555555989150,
    > offset=2147483136, bytes=2097152, qiov=0x7ffff4122e10, qiov_offset=0,
    > 
    >     flags=0) at block/io.c:1756
    > 
    > #15 0x000055555560b4b4 in bdrv_co_preadv (child=0x555555989150,
    > offset=2147483136, bytes=2097152, qiov=0x7ffff4122e10, flags=0)
    > 
    >     at block/io.c:1714
    > 
    > #16 0x00005555555f34c3 in blk_do_preadv (blk=0x55555597b010,
    > offset=2147483136, bytes=2097152, qiov=0x7ffff4122e10, flags=0)
    > 
    >     at block/block-backend.c:1211
    > 
    > #17 0x00005555555f351b in blk_co_preadv (blk=0x55555597b010,
    > offset=2147483136, bytes=2097152, qiov=0x7ffff4122e10, flags=0)
    > 
    >     at block/block-backend.c:1223
    > 
    > #18 0x000055555557347b in blk_co_pread (blk=0x55555597b010,
    > offset=2147483136, bytes=2097152, buf=0x7fffefdff000, flags=0)
    > 
    >     at /home/swapnil/dev/github/qemu/include/sysemu/block-backend.h:140
    > 
    > #19 0x00005555555771aa in convert_co_read (s=0x7fffffffdc30,
    > sector_num=4194303, nb_sectors=4096, buf=0x7fffefdff000 "") at
    > qemu-img.c:1830
    > 
    > #20 0x000055555557785c in convert_co_do_copy (opaque=0x7fffffffdc30) at
    > qemu-img.c:2007
    > 
    > #21 0x00005555556a9e4e in coroutine_trampoline (i0=1436133568, i1=21845)
    > at util/coroutine-ucontext.c:173
    > 
    > #22 0x00007ffff64e1190 in ?? () from /lib64/libc.so.6
    > 
    > #23 0x00007fffffffd2e0 in ?? ()
    > 
    > #24 0x0000000000000000 in ?? ()
    > 
    >  
    > 
    > Thanks and Regards,
    > 
    > -Swapnil
    > 
    >  
    > 




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-05 15:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-28 16:53 qemu-img convert asserts while converting from vhdx to raw Swapnil Ingle
2020-07-29 10:56 ` Max Reitz
2020-08-05 15:54   ` Swapnil Ingle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.