Red Hat Bugzilla – Bug 676788
libguestfs trace segfaults when list-filesystems returns error
Last modified: 2015-09-27 22:02:43 EDT
Description of problem: Run "guestfish --remote" commands "set-trace 1" and "list-filesystems" before "run" or "add" command will lead to error "guestfish: remote: looks like the server is not running". Version-Release number of selected component (if applicable): libguestfs-1.7.17-12.el6 How reproducible: 100% Steps to Reproduce: 1. # eval `guestfish --listen` 2. # guestfish --remote -- -add /data/images/RHEL-Server-5.5-32-hvm.raw 3. # guestfish --remote -- -set-trace 1 4. # guestfish --remote -- -list-filesystems libguestfs: trace: list_filesystems libguestfs: trace: list_devices libguestfs: error: list_devices: call launch before using this function (in guestfish, don't forget to use the 'run' command) libguestfs: trace: list_devices = NULL (error) libguestfs: trace: list_filesystems = ["guestfish: protocol error: could not decode reply from server 5. # guestfish --remote -- -run guestfish: remote: looks like the server is not running Actual results: guestfish remote server down after reporting error, "guestfish --listen" process lost. In guestfish interactive shell there's no similar problem, shell still work after reporting error. Expected results: guestfish remote server should still be alive after reporting error. Additional info: 1. if no "set-trace" command executed before "list-filesystems", guestfish server doesn't down. 2. if execute "run" command before "list-filesystems", guestfish server doesn't down.
Since this bug exists upstream too, I have cloned it as bug 682756.
This is nothing to do with remote, and all to do with the trace patch. Simple reproducer: $ guestfish -a /dev/null -x list-filesystems libguestfs: trace: add_drive_opts "/dev/null" libguestfs: trace: add_drive_opts = 0 libguestfs: trace: list_filesystems libguestfs: trace: list_devices libguestfs: error: list_devices: call launch before using this function (in guestfish, don't forget to use the 'run' command) libguestfs: trace: list_devices = NULL (error) libguestfs: trace: list_filesystems = ["Segmentation fault (core dumped)
http://brewweb.devel.redhat.com/brew/taskinfo?taskID=3159967 (still building)
I can't work out how to make any changes to the erratum (https://errata.devel.redhat.com/errata/info/10513) but this issue is surely serious enough that it should stop us from going ahead and releasing the current (1.7.17-14) package.
rjones, I have changed the errata status to NEW_FILES, you can add this bug and new libguestfs version now. Thanks, Maggie.
Test result for libguestfs-1.7.17-14.el6: $ guestfish -a /dev/null -x list-filesystems libguestfs: trace: add_drive_opts "/dev/null" libguestfs: trace: add_drive_opts = 0 libguestfs: trace: list_filesystems libguestfs: trace: list_devices libguestfs: error: list_devices: call launch before using this function (in guestfish, don't forget to use the 'run' command) libguestfs: trace: list_devices = NULL (error) libguestfs: trace: list_filesystems = ["Segmentation fault (core dumped) result for libguestfs-1.7.17-15.el6: $ guestfish -a /dev/null -x list-filesystems libguestfs: trace: add_drive_opts "/dev/null" libguestfs: trace: add_drive_opts = 0 libguestfs: trace: list_filesystems libguestfs: trace: list_devices libguestfs: error: list_devices: call launch before using this function (in guestfish, don't forget to use the 'run' command) libguestfs: trace: list_devices = NULL (error) libguestfs: trace: list_filesystems = NULL (error) see there no seg fault after upgrading. I also tested the reproducer in Lei's description, results are similar to this test. I'm putting this VERIFIED.
Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: The guestfish set-trace command was not prepared to handle all possible error conditions. This resulted in a segmentation fault when attempting to handle several conditions. The command now handles trace errors separately, so the segmentation fault no longer occurs. Note that this bug was reported and corrected during development. It was not seen in production systems in the field.
This is fine.
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHSA-2011-0586.html