jkrh / kvms

ARMv8 hypervisor. Custom Linux KVM variant with the guest and the host memory protection, integrity verification and encryption support.
GNU General Public License v2.0
19 stars 14 forks source link
arm64-v8a virtualization

KVM compatible ARM64 hypervisor


KVM hypervisor variant that can do TDX/SEV like security for existing armv8 systems. The hypervisor is implemented such that it can function in almost any armv8 board out there with virtualization support, regardless of the fact if the system shipped with existing EL2 elements or not.

Features added over regular KVM configurations are:

Building and running on QEMU:

Host <-> Guest separation

Secure guest swap

Secure host swap

Guest kernel signature verification support

VCPU protection

KVM stores the VCPU context (i.e. registers) in the architecture specific part of the kvm_vcpu struct. The context is

The project attempts to limit the exposure of the context outside the guest once the guest initialization phase is done. To do this, the context is moved to hypervisor. KVM MMIO and instruction emulation still work on the existing VCPU context. This is selectively synchronized with the hypervisor VCPU context. On guest exit, the hypervisor updates the KVM context, and on guest entry, the hypervisor updates the hypervisor context as follows:

Copy hyp -> KVM Copy KVM -> hyp
hvc hvc args (x0...x3) hvc return code (x0)
MMIO read - load target reg
MMIO write store source reg -
sysreg read - mrs target reg
sysreg write msr source reg -

Guest system state is stored in both hyp and VCPU context. Several of the system registers are emulated and full access from KVM is required.

TBC: Floating point registers, QEMU state sync breakage

SHORT TERM TODO

1) Memory pressure testing 2) Hardened / versatile guest config and patches. We need guest configs and patches for various use cases. XHCI USB emulation support currently is one big hack (works but is insecure). https://github.com/intel/tdx/blob/guest/arch/x86/kernel/tdx-filter.c 3) Migration support 4) QEMU protected guest support to give the madvise() hint to KSM not to scan the guest memory: -cpu=host,protected-guest-support=kvms 5) Guest separation via virtio parsing 6) Read-only host kernel (stage2 locked stage1 page tables)