diff options
author | pd <pd@cvs.openbsd.org> | 2020-04-30 03:50:54 +0000 |
---|---|---|
committer | pd <pd@cvs.openbsd.org> | 2020-04-30 03:50:54 +0000 |
commit | aa0e383256cf43b2d3583c5d03ff27804627000c (patch) | |
tree | 8c9c3b58c58c87f89f6f1d83d641089b41302f00 /sys | |
parent | 4d152d6658a5e1ecb54f9008fbda1643416ef3f0 (diff) |
vmd(8): correctly terminate vm processes after sending vm
Instead of a round about way of sending a message to vmm that 'send is
successful' and terminating by vm_remove from vmm, we can send the imsg and
exit in the vm process. The sigchld handler in vmm will vm_remove it from its
structures. This is how a normal vm is terminated as well.
Previously, vm_remove was called in vmm_dispatch_vm (ie. the event handler to
receive messages from vm process) when hanlding the IMSG_VMDOP_SEND_VM_RESPONSE
(ie. the vm process has written the vm state to the fd passed on by vmctl
send). This is not how vm_remove was intented to be used as it does a
free(vm). The vm struct holds the buffers for imsg and so after handling this
IMSG_VMDOP_SEND_VM_RESPONSE message, vmm_dispatch_vm loops again to do
imsg_get(ibuf, &imsg) to read the next message (and we had just freed this
*ibuf when we freed the vm struct) causing it to segfault.
reported by kn@
ok kn@
Diffstat (limited to 'sys')
0 files changed, 0 insertions, 0 deletions