The developers of the NetBSD project on the creation of a new hypervisor and its associated virtualization stack, which are already included in the experimental branch of NetBSD-current and will be offered in the stable release of NetBSD 9. NVMM is currently limited to support for the x86_64 architecture and provides two backends to leverage hardware virtualization mechanisms: x86-SVM with AMD CPU virtualization extensions and x86-VMX for Intel CPUs. In its current form, it can run up to 128 virtual machines on a single host, each of which can be allocated up to 256 virtual CPU cores (VCPU) and 128 GB of RAM.
NVMM includes a driver that operates at the kernel level and coordinates access to hardware virtualization mechanisms, as well as the Libnvmm stack, which runs in user space. Interaction between the kernel components and user space occurs via IOCTL. A notable feature of NVMM, distinguishing it from hypervisors such as KVM, and Bhyve, is that only the minimal necessary set of wrappers around the hardware virtualization mechanisms is executed at the kernel level, while all hardware emulation code is moved from the kernel to user space. This approach allows for a reduction in the amount of code running with elevated privileges, thereby lowering the risk of compromising the entire system in the event of attacks on vulnerabilities in the hypervisor. Additionally, debugging and fuzz testing of the project are significantly simplified.
At the same time, Libnvmm itself does not contain emulator functions but only provides an API that allows for the integration of NVMM support into existing emulators, such as QEMU. The API covers functions such as creating and starting a virtual machine, allocating memory for the guest system, and distributing VCPU. To enhance security and reduce potential attack vectors, libnvmm provides only explicitly requested functions — by default, complex handlers are not triggered automatically and may not be utilized at all if they can be avoided. NVMM strives to stick to simple solutions without complicating things and allowing control over as many operational aspects as possible.
The core-level component of NVMM is tightly integrated with the NetBSD kernel, enabling performance improvements by reducing the number of context switches between the guest OS and the host environment. On the user space side, libnvmm aims to aggregate standard I/O operations and avoids unnecessary system calls. The memory allocation system is based on the pmap subsystem, allowing for guest system memory pages to be swapped to disk in case of memory shortages. NVMM is free from global locks and scales well, allowing different CPU cores to be used simultaneously for various guest virtual machines.
Based on QEMU, a solution has been developed that utilizes NVMM to engage hardware virtualization mechanisms. Work is underway to incorporate the prepared patches into the main QEMU branch. The QEMU+NVMM combination is already successfully running guest systems with FreeBSD, OpenBSD, Linux, Windows XP/7/8.1/10, and other operating systems on x86_64 systems with AMD and Intel processors (NVMM itself is not tied to a specific architecture; for example, with the creation of the appropriate backend, it can work on ARM64 systems). Among the potential further applications of NVMM is sandbox isolation of individual applications.
Source: opennet.ru
