Project

General

Profile

Actions

Bug #13010

closed

bhyve should not exit when VM debugged

Added by Patrick Mooney about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Category:
bhyve
Start date:
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
bhyve
Gerrit CR:

Description

Using mdb-bhyve on an instance with the proposed patches for #13008 and #13009, I find that the bhyve process exits immediately upon attaching to the instance:

vm_loop: unexpected VMEXIT_DEBUG

This change in behavior appears to come as part of #12792:

 vmexit_debug(struct vmctx *ctx, struct vm_exit *vmexit, int *pvcpu)
 {

+       if (gdb_port == 0) {
+               fprintf(stderr, "vm_loop: unexpected VMEXIT_DEBUG\n");
+               exit(4);
+       }
        gdb_cpu_suspend(*pvcpu);
        return (VMEXIT_CONTINUE);
 }

Since we're not expecting to use gdb to debug bhyve instances, we ignore that bail-out path for now and keep the instance running.

Actions #1

Updated by Electric Monk about 1 year ago

  • Gerrit CR set to 827
Actions #2

Updated by Patrick Mooney about 1 year ago

While testing the combined fixes to #13008 and #13009, I would see the bhyve process immediately exit as described above. With this additional fix in place and a -G -1 argument in the bhyve command line (to initialize internal gdb state) I'm able to attach to the instance w/o the bhyve process immediately exiting. Whenever I either continue (@:c) in mdb, or detach from the instance, I can see its execution resume.

Actions #3

Updated by Electric Monk about 1 year ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

git commit c3d209cab1511045e9bb1a521f1bd85995d4fd7e

commit  c3d209cab1511045e9bb1a521f1bd85995d4fd7e
Author: Patrick Mooney <pmooney@pfmooney.com>
Date:   2020-08-10T22:55:03.000Z

    13008 bhyve devmem could match better
    13009 mdb-bhyve mishandles memseg offsets
    13010 bhyve should not exit when VM debugged
    Reviewed by: Andy Fiddaman <andy@omniosce.org>
    Reviewed by: Hans Rosenfeld <rosenfeld@grumpf.hope-2000.org>
    Approved by: Robert Mustacchi <rm@fingolfin.org>

Actions

Also available in: Atom PDF