Bug 1779120 - virt-v2v segfaults when called with --key option
Summary: virt-v2v segfaults when called with --key option
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libguestfs
Version: 8.1
Hardware: Unspecified
OS: Unspecified
high
urgent
Target Milestone: rc
: 8.0
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard: V2V
Depends On: 1776468
Blocks: 1771933
TreeView+ depends on / blocked
 
Reported: 2019-12-03 10:56 UTC by Pino Toscano
Modified: 2020-11-14 05:48 UTC (History)
9 users (show)

Fixed In Version: libguestfs-1.40.2-16.module+el8.1.1+5096+6326d3d5
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1776468
Environment:
Last Closed: 2020-02-04 18:29:59 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:0404 0 None None None 2020-02-04 18:30:31 UTC

Description Pino Toscano 2019-12-03 10:56:43 UTC
+++ This bug was initially created as a clone of Bug #1776468 +++

Description of problem:
When runnning virt-v2v with --key option to convert a virtual machine with LUKS encrypted devices, the process segfaults, with the following error message: *** Error in `/usr/bin/virt-v2v': realloc(): invalid next size: 0x000055ea09ac1bf0 ***.

Version-Release number of selected component (if applicable): 1.40.2-5.el7_7.1.x86_64

How reproducible: Always


Steps to Reproduce:
1. Run virt-v2v with --key option

Actual results: Process segfaults

Expected results: Process converts the virtual machine


Additional info:
The fix already exist: https://github.com/libguestfs/libguestfs-common/commit/8c42f772614b44a8cb974afa904ec9f518431ab2

Comment 2 liuzi 2019-12-12 06:26:30 UTC
Verify bug with builds:
virt-v2v-1.40.2-16.module+el8.1.1+5096+6326d3d5.x86_64
libguestfs-1.40.2-16.module+el8.1.1+5096+6326d3d5.x86_64

Steps to verify the bug:
1.Prepare a rhel7 guest,and encrypted the guest's disk during installing.
# lsblk
NAME                                          MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
sda                                             8:0    0    7G  0 disk  
├─sda1                                          8:1    0    1G  0 part  /boot
└─sda2                                          8:2    0    6G  0 part  
  ├─rhel_bootp--73--75--198-root              253:0    0  5.4G  0 lvm   /
  └─rhel_bootp--73--75--198-swap              253:1    0  604M  0 lvm   [SWAP]
sdb                                             8:16   0    1G  0 disk  
└─sdb1                                          8:17   0 1023M  0 part  
  └─luks-37c6d85c-4e6b-48b1-9ae6-d86a4ad3fa33 253:2    0 1021M  0 crypt 
    └─rhel-home                               253:3    0 1016M  0 lvm   /home
sdc                                             8:32   0    1G  0 disk  
└─sdc1                                          8:33   0 1023M  0 part  
  └─luks-e3a90385-a244-4510-b844-396dbce9209e 253:4    0 1021M  0 crypt 
    └─rhel7-var                               253:5    0 1016M  0 lvm   /var
sr0                                            11:0    1 1024M  0 rom  

2.Use virt-v2v to convert the above guest with --key parameter
# virt-v2v -ic vpx://root.73.141/data/10.73.75.219/?no_verify=1  esx6.7-rhel7.7-syscrypt-2luks  -o rhv -os 10.66.144.40:/home/nfs_export --password-file /home/passwd  --key "/dev/sdb1":key:12345678  --key "/dev/sdc1":key:12345678
[   0.0] Opening the source -i libvirt -ic vpx://root.73.141/data/10.73.75.219/?no_verify=1 esx6.7-rhel7.7-syscrypt-2luks
[   3.6] Creating an overlay to protect the source from being modified
[   5.1] Opening the overlay
[  45.2] Inspecting the overlay
[ 226.1] Checking for sufficient free disk space in the guest
[ 226.1] Estimating space required on target for each disk
[ 226.1] Converting Red Hat Enterprise Linux Server 7.7 (Maipo) to run on KVM
virt-v2v: warning: guest tools directory ‘linux/el7’ is missing from 
the virtio-win directory or ISO.

Guest tools are only provided in the RHV Guest Tools ISO, so this can 
happen if you are using the version of virtio-win which contains just the 
virtio drivers.  In this case only virtio drivers can be installed in the 
guest, and installation of Guest Tools will be skipped.
virt-v2v: This guest has virtio drivers installed.
[1870.5] Mapping filesystem data to avoid copying unused and blank areas
virt-v2v: warning: fstrim on guest filesystem /dev/rhel7/var failed.  
Usually you can ignore this message.  To find out more read "Trimming" in 
virt-v2v(1).

Original message: fstrim: fstrim: /sysroot/: the discard operation is not 
supported
virt-v2v: warning: fstrim on guest filesystem /dev/rhel/home failed.  
Usually you can ignore this message.  To find out more read "Trimming" in 
virt-v2v(1).

Original message: fstrim: fstrim: /sysroot/: the discard operation is not 
supported
[1874.8] Closing the overlay
[1875.1] Assigning disks to buses
[1875.1] Checking if the guest needs BIOS or UEFI to boot
[1875.1] Initializing the target -o rhv -os 10.66.144.40:/home/nfs_export
[1875.5] Copying disk 1/3 to /tmp/v2v.fNBCXb/5792ab14-7746-4340-a27d-845dc12b8db9/images/99621598-9b08-4ea0-a0f8-a91848d62d99/5465714f-ab2c-4549-9045-bd322aae69a3 (raw)
    (100.00/100%)
[2264.5] Copying disk 2/3 to /tmp/v2v.fNBCXb/5792ab14-7746-4340-a27d-845dc12b8db9/images/89fef06c-26f0-4c57-bdd4-b73bb88c39d9/30042db9-a25a-487e-b17e-b7c345a4d7c4 (raw)
    (100.00/100%)
[2357.3] Copying disk 3/3 to /tmp/v2v.fNBCXb/5792ab14-7746-4340-a27d-845dc12b8db9/images/6f468fde-59bc-4616-8c9e-4f9c9140ff4f/72c83a84-b1a9-414b-b510-a224567d2c65 (raw)
    (100.00/100%)
[2444.6] Creating output metadata
[2444.6] Finishing off

3.virt-v2v can convert guest successfully,then log into rhv to check the new guest
3.1 The guest can use password to unlock the encrypted luks and boot normally 
3.2 The guest can pass all general checkpoints.

Result:When use parameter --key more than once in command,virt-v2v will not crash and finish the conversion successfully.So change the bug from ON_QA to VERIFIED.

Comment 4 errata-xmlrpc 2020-02-04 18:29:59 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-2020:0404


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