Bug 1000121

Summary: 'sh' command before mount causes daemon to segfault
Product: [Community] Virtualization Tools Reporter: Richard W.M. Jones <rjones>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED UPSTREAM QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: unspecifiedCC: acathrow, mbooth
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1000122 1000123 (view as bug list) Environment:
Last Closed: 2013-08-22 18:41:30 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1000122, 1000123    

Description Richard W.M. Jones 2013-08-22 18:32:52 UTC
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: