diff options
author | 2020-04-30 03:50:53 +0000 | |
---|---|---|
committer | 2020-04-30 03:50:53 +0000 | |
commit | a31b2e6b74d4794153ce981ee430f1cfb8e7757e (patch) | |
tree | 388c7c6c86fd1248829fddfc557bfbcbcb1ab4f8 /lib/libsndio/sioctl_sun.c | |
parent | Enable a bunch of drivers needed for full Raspberry Pi 2/3 support. (diff) | |
download | wireguard-openbsd-a31b2e6b74d4794153ce981ee430f1cfb8e7757e.tar.xz wireguard-openbsd-a31b2e6b74d4794153ce981ee430f1cfb8e7757e.zip |
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 'lib/libsndio/sioctl_sun.c')
0 files changed, 0 insertions, 0 deletions