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 1142158 - Illegal command 'part-get-name /dev/sda1 1' cause libguestfs appliance crashed
Summary: Illegal command 'part-get-name /dev/sda1 1' cause libguestfs appliance crashed
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.1
Hardware: Unspecified
OS: Unspecified
low
low
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-09-16 09:29 UTC by Lingfei Kong
Modified: 2015-03-05 13:45 UTC (History)
4 users (show)

Fixed In Version: libguestfs-1.27.48-1.1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-03-05 13:45:02 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:0303 0 normal SHIPPED_LIVE libguestfs bug fix and enhancement update 2015-03-05 17:34:44 UTC

Description Lingfei Kong 2014-09-16 09:29:32 UTC
Description of problem:
Illegal command 'part-get-name /dev/sda1 1' cause libguestfs appliance crashed. 
I read the help message of API: part-get-name, find that this API may only read from the guest image, so even if the command is illegal, it should not casue libguestfs appliance crashed.


Version-Release number of selected component (if applicable):
libguestfs-1.27.43-1.1.el7


How reproducible:
100%


Steps to Reproduce:
1. Create a raw format guest image: rhel6.6.img
2. #guestfish -a rhel6.6.img
><fs> run
><fs> part-get-name /dev/sda1 1
libguestfs: error: part_get_name: not a partitioned device
><fs> part-get-name /dev/sda1 1
libguestfs: error: appliance closed the connection unexpectedly.
This usually means the libguestfs appliance crashed.
See http://libguestfs.org/guestfs-faq.1.html#debugging-libguestfs
for information about how to debug libguestfs and report bugs.
><fs> list-filesystems
libguestfs: error: feature_available: call launch before using this function
(in guestfish, don't forget to use the 'run' command)
libguestfs: error: feature_available: call launch before using this function
(in guestfish, don't forget to use the 'run' command)
libguestfs: error: list_devices: call launch before using this function
(in guestfish, don't forget to use the 'run' command)


More detail informations:
# export LIBGUESTFS_TRACE=1
# export LIBGUESTFS_DEBUG=1
 #guestfish -a rhel6.6.img
><fs> run
><fs> part-get-name /dev/sda1 1
libguestfs: trace: part_get_name "/dev/sda1" 1
guestfsd: main_loop: new request, len 0x3c
parted -s -m /dev/null
Error: The device /dev/null is so small that it cannot possibly store a file system or partition table.  Perhaps you selected the wrong device?
Warning: Error fsyncing/closing /dev/null: Invalid argument
parted -m -- /dev/sda1 unit b print
guestfsd: error: not a partitioned device
*** Segmentation fault
Register dump:

 RAX: 0000000000000000libguestfs: trace: part_get_name = NULL (error)
libguestfs: error: part_get_name: not a partitioned device
><fs> part-get-name /dev/sda1 1
libguestfs: trace: part_get_name "/dev/sda1" 1
   RBX: 00007f7f08ef50c0   RCX: 0000000000000000
 RDX: 0000000000000000   RSI: 00000000ffffffff   RDI: 00007f7f025f0760
 RBP: 0000000000000001   R8 : 0000000000000001   R9 : 0000000000000079
 R10: 0000000000000000   R11: 0000000000000246   R12: 00007fff7bb87800
 R13: 00007f7bb8778c   R14: 00007fff7bb877d0   R15: 000000000000003c
 RSP: 00007fff7bb87630

 RIP: 00007f7f03f82049   EFLAGS: 00010206

 CS: 0033   FS: 0000   GS: 0000

 Trap: 0000000e   Error: 00000004   OldMask: 00000000   CR2: 00000000

 FPUCW: 0000037f   FPUSW: 00000000   TAG: 00000000
 RIP: 00000000   RDP: 00000000

 ST(0) 0000 0000000000000000   ST(1) 0000 0000000000000000
 ST(2) 0000 0000000000000000   ST(3) 0000 0000000000000000
 ST(4) 0000 0000000000000000   ST(5) 0000 0000000000000000
 ST(6) 0000 0000000000000000   ST(7) 0000 0000000000000000
 mxcsr: 1f80
 XMM0:  000000000000000000000000ffff0000 XMM1:  000000000000000000000000ffff0000
 XMM2:  000000000000000000000000ffff0000 XMM3:  000000000000000000000000ffff0000
 XMM4:  000000000000000000000000ffff0000 XMM5:  000000000000000000000000ffff0000
 XMM6:  000000000000000000000000ffff0000 XMM7:  000000000000000000000000ffff0000
 XMM8:  000000000000000000000000ffff0000 XMM9:  000000000000000000000000ffff0000
 XMM10: 000000000000000000000000ffff0000 XMM11: 000000000000000000000000ffff0000
 XMM12: 000000000000000000000000ffff0000 XMM13: 000000000000000000000000ffff0000
 XMM14: 000000000000000000000000ffff0000 XMM15: 000000000000000000000000ffff0000

Backtrace:
guestfsd(+0x2e049)[0x7f7f03f82049]
guestfsd(+0x4ef50)[0x7f7f03fa2f50]
guestfsd(+0x50e97)[0x7f7f03fa4e97]
guestfsd(+0x2ece6)[0x7f7f03f82ce6]
guestfsd(+0xa20f)[0x7f7f03f5e20f]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7f7f02257af5]
guestfsd(+0xa491)[0x7f7f03f5e491]

Memory map:

7f7f008d0000-7f7f009d1000 r-xp 00000000 08:10 432                        /usr/lib64/libm-2.17.so
7f7f009d1000-7f7f00bd0000 ---p 00101000 08:10 432                        /usr/lib64/libm-2.17.so
7f7f00bd0000-7f7f00bd1000 r--p 00100000 08:10 432                        /usr/lib64/libm-2.17.so
7f7f00bd1000-7f7f00bd2000 rw-p 00101000 08:10 432                        /usr/lib64/libm-2.17.so
7f7f00bd2000-7f7f00be7000 r-xp 00000000 08:10 2871                       /usr/lib64/libz.so.1.2.7
7f7f00be7000-7f7f00de6000 ---p 00015000 08:10 2871                       /usr/lib64/libz.so.1.2.7
7f7f00de6000-7f7f00de7000 r--p 00014000 08:10 2871                       /usr/lib64/libz.so.1.2.7
7f7f00de7000-7f7f00de8000 rw-p 00015000 08:10 2871                       /usr/lib64/libz.so.1.2.7
7f7f00de8000-7f7f00dfe000 r-xp 00000000 08:10 457                        /usr/lib64/libpthread-2.17.so
7f7f00dfe000-7f7f00ffe000 ---p 00016000 08:10 457                        /usr/lib64/libpthread-2.17.so
7f7f00ffe000-7f7f00fff000 r--p 00016000 08:10 457                        /usr/lib64/libpthread-2.17.so
7f7f00fff000-7f7f01000000 rw-p 00017000 08:10 457                        /usr/lib64/libpthread-2.17.so
7f7f01000000-7f7f01004000 rw-p 00000000 00:00 0
7f7f01004000-7f7f01008000 r-xp 00000000 08:10 429                        /usr/lib64/libgpg-error.so.0.10.0
7f7f01008000-7f7f01207000 ---p 00004000 08:10 429                        /usr/lib64/libgpg-error.so.0.10.0
7f7f01207000-7f7f01208000 r--p 00003000 08:10 429                        /usr/lib64/libgpg-error.so.0.10.0
7f7f01208000-7f7f01209000 rw-p 00004000 08:10 429                        /usr/lib64/libgpg-error.so.0.10.0
7f7f01209000-7f7f01280000 r-xp 00000000 08:10 2665                       /usr/lib64/libgcrypt.so.11.8.2
7f7f01280000-7f7f01480000 ---p 00077000 08:10 2665                       /usr/lib64/libgcrypt.so.11.8.2
7f7f01480000-7f7f01481000 r--p 00077000 08:10 2665                       /usr/lib64/libgcrypt.so.11.8.2
7f7f01481000-7f7f01484000 rw-p 00078000 08:10 2665                       /usr/lib64/libgcrypt.so.11.8.2
7f7f01484000-7f7f0148b000 r-xp 00000000 08:10 463                        /usr/lib64/librt-2.17.so
7f7f0148b000-7f7f0168a000 ---p 00007000 08:10 463                        /usr/lib64/librt-2.17.so
7f7f0168a000-7f7f0168b000 r--p 00006000 08:10 463                        /usr/lib64/librt-2.17.so
7f7f0168b000-7f7f0168c000 rw-p 00007000 08:10 463                        /usr/lib64/librt-2.17.so
7f7f0168c000-7f7f017ea000 r-xp 00000000 08:10 2865                       /usr/lib64/libxml2.so.2.9.1
7f7f017ea000-7f7f019e9000 ---p 0015e000 08:10 2865                       /usr/lib64/libxml2.so.2.9.1
7f7f019e9000-7f7f019f1000 r--p 0015d000 08:10 2865                       /usr/lib64/libxml2.so.2.9.1
7f7f019f1000-7f7f019f3000 rw-p 00165000 08:10 2865                       /usr/lib64/libxml2.so.2.9.1
7f7f019f3000-7f7f019f5000 rw-p 00000000 00:00 0
7f7f019f5000-7f7f01a07000 r-xp 00000000 08:10 2653                       /usr/lib64/libfa.so.1.4.0
7f7f01a07000-7f7f01c06000 ---p 00012000 08:10 2653                       /usr/lib64/libfa.so.1.4.0
7f7f01c06000-7f7f01c07000 r--p 00011000 08:10 2653                       /usr/lib64/libfa.so.1.4.0
7f7f01c07000-7f7f01c08000 rw-p 00012000 08:10 2653                       /usr/lib64/libfa.so.1.4.0
7f7f01c08000-7f7f01c0b000 r-xp 00000000 08:10 424                        /usr/lib64/libdl-2.17.so
7f7f01c0b000-7f7f01e0a000 ---p 00003000 08:10 424                        /usr/lib64/libdl-2.17.so
7f7f01e0a000-7f7f01e0b000 r--p 00002000 08:10 424                        /usr/lib64/libdl-2.17.so
7f7f01e0b000-7f7f01e0c000 rw-p 00003000 08:10 424                        /usr/lib64/libdl-2.17.so
7f7f01e0c000-7f7f01e30000 r-xp 00000000 08:10 2743                       /usr/lib64/liblzma.so.5.0.99
7f7f01e30000-7f7f0202f000 ---p 00024000 08:10 2743                       /usr/lib64/liblzma.so.5.0.99
7f7f0202f000-7f7f02030000 r--p 00023000 08:10 2743                       /usr/lib64/liblzma.so.5.0.99
7f7f02030000-7f7f02031000 rw-p 00024000 08:10 2743                       /usr/lib64/liblzma.so.5.0.99
7f7f02031000-7f7f02035000 r-xp 00000000 08:10 2617                       /usr/lib64/libattr.so.1.1.0
7f7f02035000-7f7f02234000 ---p 00004000 08:10 2617                       /usr/lib64/libattr.so.1.1.0
7f7f02234000-7f7f02235000 r--p 00003000 08:10 2617                       /usr/lib64/libattr.so.1.1.0
7f7f02235000-7f7f02236000 rw-p 00004000 08:10 2617                       /usr/lib64/libattr.so.1.1.0
7f7f02236000-7f7f023ec000 r-xp 00000000 08:10 414                        /usr/lib64/libc-2.17.so
7f7f023ec000-7f7f025ec000 ---p 001b6000 08:10 414                        /usr/lib64/libc-2.17.so
7f7f025ec000-7f7f025f0000 r--p 001b6000 08:10 414                        /usr/lib64/libc-2.17.so
7f7f025f0000-7f7f025f2000 rw-p 001ba000 08:10 414                        /usr/lib64/libc-2.17.so
7f7f025f2000-7f7f025f7000 rw-p 00000000 00:00 0
7f7f025f7000-7f7f0260c000 r-xp 00000000 08:10 426                        /usr/lib64/libgcc_s-4.8.2-20140120.so.1
7f7f0260c000-7f7f0280b000 ---p 00015000 08:10 426                        /usr/lib64/libgcc_s-4.8.2-20140120.so.1
7f7f0280b000-7f7f0280c000 r--p 00014000 08:10 426                        /usr/lib64/libgcc_s-4.8.2-20140120.so.1
7f7f0280c000-7f7f0280d000 rw-p 00015000 08:10 426                        /usr/lib64/libgcc_s-4.8.2-20140120.so.1
7f7f0280d000-7f7f0286c000 r-xp 00000000 08:10 2793                       /usr/lib64/libpcre.so.1.2.0
7f7f0286c000-7f7f02a6c000 ---p 0005f000 08:10 2793                       /usr/lib64/libpcre.so.1.2.0
7f7f02a6c000-7f7f02a6d000 r--p 0005f000 08:10 2793                       /usr/lib64/libpcre.so.1.2.0
7f7f02a6d000-7f7f02a6e000 rw-p 00060000 08:10 2793                       /usr/lib64/libpcre.so.1.2.0
7f7f02a6e000-7f7f02a72000 r-xp 00000000 08:10 2833                       /usr/lib64/libsystemd-id128.so.0.0.26
7f7f02a72000-7f7f02c72000 ---p 00004000 08:10 2833                       /usr/lib64/libsystemd-id128.so.0.0.26
7f7f02c72000-7f7f02c73000 r--p 00004000 08:10 2833                       /usr/lib64/libsystemd-id128.so.0.0.26
7f7f02c73000-7f7f02c74000 rw-p 00005000 08:10 2833                       /usr/lib64/libsystemd-id128.so.0.0.26
7f7f02c74000-7f7f02c8f000 r-xp 00000000 08:10 2835                       /usr/lib64/libsystemd-journal.so.0.11.3
7f7f02c8f000-7f7f02e8f000 ---p 0001b000 08:10 2835                       /usr/lib64/libsystemd-journal.so.0.11.3
7f7f02e8f000-7f7f02e90000 r--p 0001b000 08:10 2835                       /usr/lib64/libsystemd-journal.so.0.11.3
7f7f02e90000-7f7f02e91000 rw-p 0001c000 08:10 2835                       /usr/lib64/libsystemd-journal.so.0.11.3
7f7f02e91000-7f7f02ea3000 r-xp 00000000 08:10 2693                       /usr/lib64/libhivex.so.0.0.0
7f7f02ea3000-7f7f030a2000 ---p 00012000 08:10 2693                       /usr/lib64/libhivex.so.0.0.0
7f7f030a2000-7f7f030a3000 r--p 00011000 08:10 2693                       /usr/lib64/libhivex.so.0.0.0
7f7f030a3000-7f7f030a4000 rw-p 00012000 08:10 2693                       /usr/lib64/libhivex.so.0.0.0
7f7f030a4000-7f7f030ed000 r-xp 00000000 08:10 2619                       /usr/lib64/libaugeas.so.0.17.0
7f7f030ed000-7f7f032ec000 ---p 00049000 08:10 2619                       /usr/lib64/libaugeas.so.0.17.0
7f7f032ec000-7f7f032ee000 r--p 00048000 08:10 2619                       /usr/lib64/libaugeas.so.0.17.0
7f7f032ee000-7f7f032ef000 rw-p 0004a000 08:10 2619                       /usr/lib64/libaugeas.so.0.17.0
7f7f032ef000-7f7f03310000 r-xp 00000000 08:10 2814                       /usr/lib64/libselinux.so.1
7f7f03310000-7f7f03510000 ---p 00021000 08:10 2814                       /usr/lib64/libselinux.so.1
7f7f03510000-7f7f03511000 r--p 00021000 08:10 2814                       /usr/lib64/libselinux.so.1
7f7f03511000-7f7f03512000 rw-p 00022000 08:10 2814                       /usr/lib64/libselinux.so.1
7f7f03512000-7f7f03514000 rw-p 00000000 00:00 0
7f7f03514000-7f7f0351c000 r-xp 00000000 08:10 2869                       /usr/lib64/libyajl.so.2.0.4
7f7f0351c000-7f7f0371c000 ---p 00008000 08:10 2869                       /usr/lib64/libyajl.so.2.0.4
7f7f0371c000-7f7f0371d000 r--p 00008000 08:10 2869                       /usr/lib64/libyajl.so.2.0.4
7f7f0371d000-7f7f0371e000 rw-p 00009000 08:10 2869                       /usr/lib64/libyajl.so.2.0.4
7f7f0371e000-7f7f03722000 r-xp 00000000 08:10 2628                       /usr/lib64/libcap.so.2.22
7f7f03722000-7f7f03921000 ---p 00004000 08:10 2628                       /usr/lib64/libcap.so.2.22
7f7f03921000-7f7f03922000 r--p 00003000 08:10 2628                       /usr/lib64/libcap.so.2.22
7f7f03922000-7f7f03923000 rw-p 00004000 08:10 2628                       /usr/lib64/libcap.so.2.22
7f7f03923000-7f7f0392a000 r-xp 00000000 08:10 2615                       /usr/lib64/libacl.so.1.1.0
7f7f0392a000-7f7f03b2a000 ---p 00007000 08:10 2615                       /usr/lib64/libacl.so.1.1.0
7f7f03b2a000-7f7f03b2b000 r--p 00007000 08:10 2615                       /usr/lib64/libacl.so.1.1.0
7f7f03b2b000-7f7f03b2c000 rw-p 00008000 08:10 2615                       /usr/lib64/libacl.so.1.1.0
7f7f03b2c000-7f7f03b30000 r-xp 00000000 08:10 407                        /usr/lib64/libSegFault.so
7f7f03b30000-7f7f03d2f000 ---p 00004000 08:10 407                        /usr/lib64/libSegFault.so
7f7f03d2f000-7f7f03d30000 r--p 00003000 08:10 407                        /usr/lib64/libSegFault.so
7f7f03d30000-7f7f03d31000 rw-p 00004000 08:10 407                        /usr/lib64/libSegFault.so
7f7f03d31000-7f7f03d52000 r-xp 00000000 08:10 403                        /usr/lib64/ld-2.17.so
7f7f03f40000-7f7f03f4c000 rw-p 00000000 00:00 0
7f7f03f4f000-7f7f03f51000 rw-p 00000000 00:00 0
7f7f03f51000-7f7f03f52000 r--p 00020000 08:10 403                        /usr/lib64/ld-2.17.so
7f7f03f52000-7f7f03f53000 rw-p 00021000 08:10 403                        /usr/lib64/ld-2.17.so
7f7f03f53000-7f7f03f54000 rw-p 00000000 00:00 0
7f7f03f54000-7f7f03fdf000 r-xp 00000000 08:10 196                        /usr/sbin/guestfsd
7f7f041df000-7f7f041e2000 r--p 0008b000 08:10 196                        /usr/sbin/guestfsd
7f7f041e2000-7f7f041e3000 rw-p 0008e000 08:10 196                        /usr/sbin/guestfsd
7f7f041e3000-7f7f081e5000 rw-p 00000000 00:00 0
7f7f08ef4000-7f7f08f15000 rw-p 00000000 00:00 0                          [heap]
7fff7bb67000-7fff7bb88000 rw-p 00000000 00:00 0                          [stack]
7fff7bbfe000-7fff7bc00000 r-xp 00000000 00:00 0                          [vdso]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0                  [vsyscall]
/init: line 167:   186 Segmentation fault      $vg guestfsd
Rebooting.
[   10.138145] Unregister pv shared memory for cpu 0
[   10.138685] sd 2:0:1:0: [sdb] Synchronizing SCSI cache
[   10.140617] sd 2:0:0:0: [sda] Synchronizing SCSI cache
[   10.192114] Restarting system.
[   10.192448] reboot: machine restart
libguestfs: error: appliance closed the connection unexpectedly, see earlier error messages
libguestfs: child_cleanup: 0x7f3abffc8970: child process died
libguestfs: calling virDomainDestroy "guestfs-lnspmnl5qqc4tymv" flags=0
libguestfs: trace: part_get_name = NULL (error)


Actual results:
libguestfs: error: appliance closed the connection unexpectedly.
This usually means the libguestfs appliance crashed.


Expected results:
Illegal command 'part-get-name /dev/sda1 1' failed with a proper error message and  libguestfs appliance do not crashed.


Additional info:

Comment 2 Richard W.M. Jones 2014-09-17 14:28:35 UTC
One line reproducer:

guestfish -N fs part-get-name /dev/sda1 1 -v -x

and yes, it causes guestfsd to segfault(!)

Comment 5 Lingfei Kong 2014-10-22 06:53:41 UTC
Verify with libguestfs-1.28.1-1.2.el7

Steps to verify:
#guestfish -a rhel.img
><fs> run
 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ --:--
><fs> part-get-name /dev/sda1 1
libguestfs: error: part_get_name: not a partitioned device
><fs> part-get-name /dev/sda1 1
libguestfs: error: part_get_name: not a partitioned device
><fs> part-get-name /dev/sda1 1
libguestfs: error: part_get_name: not a partitioned device
><fs> list-filesystems 
/dev/sda1: ext4
/dev/VolGroup/lv_root: ext4
/dev/VolGroup/lv_swap: swap


Appliance not crashed, so bug is fixed.

Comment 7 errata-xmlrpc 2015-03-05 13:45:02 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://rhn.redhat.com/errata/RHBA-2015-0303.html


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