Bug 1000123 - 'sh' command before mount causes daemon to segfault
Summary: 'sh' command before mount causes daemon to segfault
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libguestfs
Version: 7.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Richard W.M. Jones
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On: 1000121
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-08-22 18:33 UTC by Richard W.M. Jones
Modified: 2014-06-18 02:01 UTC (History)
6 users (show)

Fixed In Version: libguestfs-1.22.6-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of: 1000121
Environment:
Last Closed: 2014-06-13 12:29:03 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Richard W.M. Jones 2013-08-22 18:33:52 UTC
+++ This bug was initially created as a clone of Bug #1000121 +++

Description of problem:

This bug was found by Olaf Hering.

Issuing the 'sh' command before mounting any filesystem will
cause the daemon to segfault.

Version-Release number of selected component (if applicable):

libguestfs 1.20.10
libguestfs 1.22.5
libguestfs 1.23.18

How reproducible:

100%

Steps to Reproduce:

guestfish --ro -v -a /dev/null run : sh "foo" : ls /

Actual results:

You will see in the debug output that guestfsd has segfaulted.
The output will look similar to:

guestfsd: error: do_command: you must call 'mount' first to mount the root filesystem
*** Error in `guestfsd': free(): invalid pointer: 0x00007fffc1c8d560 ***
libguestfs: error: sh: do_command: you must call 'mount' first to mount the root filesystem
/init: line 167:   145 Aborted                 $vg guestfsd
Rebooting.

(The precise message will differ between versions of libguestfs
but it should be obvious that guestfsd has segfaulted)

Expected results:

guestfsd should return an error and not segfault.

Additional info:

Comment 4 Lingfei Kong 2013-11-01 09:15:11 UTC
Reproduce:

Version-Release number of selected component: libguestfs-1.22.5-3.el7

Steps:
guestfish --ro -v -a /dev/null run : sh "foo" : ls /

Result: 
guestfsd: error: do_command: you must call 'mount' first to mount the root filesystem
*** Segmentation fault
Register dump:
libguestfs: error: sh: do_command: you must call 'mount' first to mount the root filesystem
libguestfs: closing guestfs handle 0x7fac5c3dacf0 (state 2)
....
/init: line 170:   115 Segmentation fault      $vg guestfsd
Rebooting.

guestfsd segfault.

Comment 5 Lingfei Kong 2013-12-06 08:34:55 UTC
Verified with libguestfs-1.22.6-15.el7

Step:
#guestfish --ro -v -a /dev/null run : sh "foo" : ls /

.......
udevadm settle
libguestfs: recv_from_daemon: received GUESTFS_LAUNCH_FLAG
libguestfs: [05328ms] appliance is up
guestfsd: main_loop: new request, len 0x30
guestfsd: error: do_command: you must call 'mount' first to mount the root filesystem
guestfsd: main_loop: prlibguestfs: error: sh: do_command: you must call 'mount' first to mount the root filesystem
libguestfs: closing guestfs handle 0x7fa7e8b266b0 (state 2)
oc 111 (sh) took 0.00 seconds
guestfsd: main_loop: new request, len 0x28
fsync /dev/sda
guestfsd: main_loop: proc 282 (internal_autosync) took 0.01 seconds
libguestfs: command: run: rm
libguestfs: command: run: \ -rf /tmp/libguestfsCA3EGv



Also I can not find some words like 'segfault' in the output, so but is fixed.

Comment 6 Ludek Smid 2014-06-13 12:29:03 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.


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