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 root# vmd -dvvv startup vm_register: registering vm 1 /etc/vm.conf:12: vm "amd64" registered (disabled) /etc/vm.conf:16: switch "uplink" registered vm_priv_brconfig: interface bridge0 description switch1-uplink vmd_configure: setting staggered start configuration to parallelism: 4 and delay: 30 vmd_configure: starting vms in staggered fashion start_vm_batch: starting batch of 4 vms start_vm_batch: not starting vm amd64 (disabled) start_vm_batch: done starting vms config_getconfig: priv retrieving config config_getconfig: control retrieving config config_getconfig: vmm retrieving config vm_register: registering vm 2 vm_opentty: vm test tty /dev/ttyp8 uid 0 gid 4 mode 620 vm_register: registering vm 2 test: started vm 2 successfully, tty /dev/ttyp8 loadfile_elf: loaded ELF kernel run_vm: initializing hardware for vm test pic_set_elcr: setting level triggered mode for irq 3 pic_set_elcr: setting level triggered mode for irq 5 run_vm: starting vcpu threads for vm test vcpu_reset: resetting vcpu 0 for vm 8 run_vm: waiting on events for VM test vcpu_exit_i8253: channel 0 reset, mode=2, start=65535 vcpu_process_com_lcr: set baudrate = 115200 i8259_write_datareg: master pic, reset IRQ vector to 0x20 i8259_write_datareg: slave pic, reset IRQ vector to 0x28 vcpu_exit_i8253: channel 0 reset, mode=2, start=11932 vcpu_process_com_lcr: set baudrate = 115200 vcpu_process_com_lcr: set baudrate = 115200 vmd_dispatch_vmm: running vm: 2, vm_state: 0x1 vmd_dispatch_vmm: vm: 1, vm_state: 0x2 vmd_dispatch_control: sending fd to vmm i8253_dump: sending PIT i8259_dump: sending PIC i8259_dump: sending ELCR ns8250_dump: sending UART mc146818_dump: sending RTC fw_cfg_dump: sending fw_cfg state pci_dump: sending pci viornd_dump: sending viornd vioblk_dump: sending vioblk vionet_dump: sending vionet vmmci_dump: sending vmmci vm_remove: vmm vmm_dispatch_vm removing vm 2 from running config vm_stop: vmm vmm_dispatch_vm stopping vm 2 test: sent vm 2 successfully. vm_remove: parent vmd_dispatch_vmm removing vm 2 from running config vm_stop: parent vmd_dispatch_vmm stopping vm 2 control_dispatch_vmd: lost control connection: fd 7 vmm_sighdlr: handling signal 20 > OK kn if anyone wants to commit, otherwise I'll do so tomorrow when > looking into this issue. >