* Benjamin Baier <program...@netzbasis.de> [2020-01-02 22:01:14 +0100]:

On Thu, 2 Jan 2020 18:56:14 +0100
Klemens Nanni <k...@openbsd.org> wrote:

On Thu, Jan 02, 2020 at 04:37:17PM +0100, Benjamin Baier wrote:
> "case CMD_SEND:" sets done=1 so ret will never be written to and
> the uninitialized value of ret is used to determine the return
> value of the function vmmaction.
Good catch:

        $ doas vmctl start -b ~/vm/bsd.rd -m 128M test ; echo $?
        vmctl: starting without disks
        vmctl: starting without network interfaces
        vmctl: started vm 4 successfully, tty /dev/ttyp2
        0
        $ doas vmctl send test >/dev/null ; echo $?
        vmctl: sent vm test successfully
        1

With your diff it exits zero.

I also just noticed that above example reproducibly causes vmd(8) to
exit:

Jan  2 18:53:57 eru vmd[55128]: startup
Jan  2 18:54:18 eru vmd[55128]: test: started vm 4 successfully, tty /dev/ttyp2
Jan  2 18:54:28 eru vmd[49983]: priv exiting, pid 49983
Jan  2 18:54:28 eru vmd[29885]: control exiting, pid 29885

I don't get vmd to exit, but got this in /var/log/messages with the above 
example:
Jan  2 21:38:05 x220 vmd[86810]: control_dispatch_vmd: lost control connection: 
fd 7


Hi Benjamin,

kn@ is running with vm.malloc_conf=SU.  The crash is due to vm_remove
calling free on vm here,
https://github.com/openbsd/src/blob/926f477f07d3bba063ff6ee1ea9e0b7369ed8930/usr.sbin/vmd/vmm.c#L542

will work on a fix.

--
Pratik

Reply via email to