CVSROOT: /cvs
Module name: src
Changes by: [email protected] 2026/11/11 08:32:21
Modified files:
usr.sbin/vmd : config.c
Log message:
vmd: fix pty and file leaks in vm creation path.
1. During vm creation, vmd duplicates the pty fd to let the privileged
process handle cleanup after vm termination. This dup'd fd should
be closed in the error path otherwise it leaks.
2. The combination of `vmctl reload` with a vm using a bios or
kernel boot image will leak a file descriptor to the image file.
This was a regression caused by fixing a related problem. Mischa
Peters reported vmd reporting EMFILE errors and it turns out the
priv process was keeping the file open, but reload was overwriting
the variable with the fd number so teardown wasn't closing it.
There's no need to keep it open, so rewrite to not dup(2) and don't
have the priv process keep a copy of the fd number (the source of
the previous issue related to a race between close(2) on cleanup
and the imsg sending the fd to the vmm process.)
ok hshoexer@