Linux Kernel Changes Proposed So Intel TDX KVM Guests Avoid Crashing The Host
Intel Trust Domain Extensions (TDX) allow for better hardware isolation between virtual machines and the VMM/hypervisor. TDX introduces a secure arbitration mode, multi-key total memory encryption, remote attestation, and other features. TDX is expected with next-gen Xeon Sapphire Rapids CPUs.
While Intel TDX is about improving security, with the current Linux kernel infrastructure around the Kernel-based Virtual Machine it could lead to a situation where guest VMs could crash the host with that memory encryption / guest private memory. In a new Linux kernel patch series Google engineer Sean Christopherson explained, "The TDX architectural effectively allows KVM guests to crash the host if guest private memory is accessible to host userspace, and thus does not play nice with KVM's existing approach of pulling the pfn and mapping level from the host page tables."
Sent out under a "request for comments" is a kernel patch to provide a file descriptor based approach for supporting KVM guest private memory. This is an alternative to prior Intel-posted patches around TDX guest private memory tracking at the struct page level. The kernel patch is still in its early stages, "This is by no means a complete patch; it's a rough sketch of the KVM changes that would be needed. The kernel side of things is completely omitted from the patch...There's also fair bit of hand waving on implementation details that shouldn't fundamentally change the overall ABI, e.g. how the backing store will ensure there are no mappings when "converting" to guest private."
This cover letter goes into all the technical details over the proposal for how Christopherson is proposing KVM and the kernel memory management code deal with guest private memory with Intel TDX to avoid the embarrassing possibility of guest VMs crashing the host.