Introduction ============= Microsoft Hyper-V implements Virtualization-Based Security (VBS) through Virtual Secure Mode (VSM), which uses Virtual Trust Levels (VTLs) to establish isolated execution environments enforced by the hypervisor. The primary operating system executes in VTL0, while security-sensitive components can execute in higher trust levels such as VTL1.
Linux Virtualization-Based Security (LVBS) extends this model to Linux Hyper-V guests by introducing a secure kernel running in VTL1 alongside the primary Linux kernel running in VTL0. The hypervisor enforces isolation between the two trust levels, allowing security-sensitive functionality to execute independently of the primary operating system. This RFC series introduces the foundational infrastructure required to support LVBS and boot a secure kernel in VTL1 from VTL0. Before any LVBS service can exist, VTL0 has to stand VTL1 up, load the secure kernel and boot all CPUs in VTL1. This series intentionally focuses on establishing the VTL1 execution environment and does not yet introduce higher-level LVBS services. Future RFCs will build on this foundation by adding support for VTL0 to request secure services from VTL1, attestation support, memory protection services, and other security capabilities. The goal of this RFC is to gather feedback on the overall LVBS architecture, VTL1 boot model, processor bring-up sequence, and Linux kernel integration before additional functionality is introduced. Threat Model ============= The security of the whole construction rests on the early boot path being trusted. On a VSM-capable Hyper-V guest, the VTL0 kernel is launched via Secure Boot, so the kernel image that enables VTL1 and loads the secure kernel is itself measured and signature-checked before it runs. Enabling VTL1 and populating it from VTL0 during early boot is therefore no weaker than Secure Boot itself: an attacker who can subvert this stage can already subvert the kernel before VTL1 exists. For the same reason, a Unified Kernel Image (UKI) is the preferred delivery vehicle for LVBS. A UKI bundles the kernel, initrd, cmdline, and (optionally) devicetree into a single PE binary that is signed and verified as one unit by Secure Boot. This extends the signature-verified boundary to cover the initrd, which is where the secure kernel image is staged before VTL0 hands it to VTL1. Without a UKI (or an equivalent measured-initrd scheme), an unsigned initrd would be an obvious weak spot in the chain. The series is based on hyperv-next (tag hyperv-next-signed-20260826) and boot-tested on an x86_64 Hyper-V VTL0 guest with litebox [1] as the VTL1 secure kernel. [1] https://github.com/microsoft/litebox Comments and feedback are greatly appreciated. Thara Gopinath (12): drivers: hv: Add HYPERV_VSM kconfig option drivers: hv: hv_common: Allocate Hyper-V output arg page when VSM is enabled drivers: hv: Reserve memory for VSM secure kernel during early boot firmware: efi: libstub: x86-stub: Enable VSM awareness in efi os indications variable include: hyperv: hvgdk_mini.h: Add VTL-specific structures and bits drivers: hv: Add VSM boot driver and enable VTL1 at the partition level drivers: hv: hv_vsm_boot: load secure kernel image from firmware arch: x86: hyperv: Build initial vCPU context for VTL1 secure kernel drivers: hv: hv_vsm_boot: Enable VTL1 on the boot processor arch: x86: hyperv: hv_vtl_vsm: Introduce vtlcall drivers: hv: hv_vsm_boot: Boot primary processor in VTL1 drivers: hv: hv_vsm_boot: Boot secondary processors in VTL1 arch/x86/hyperv/Makefile | 1 + arch/x86/hyperv/hv_vtl_vsm.c | 287 +++++++++++ arch/x86/hyperv/mshv-asm-offsets.c | 8 + arch/x86/hyperv/mshv_vtl_asm.S | 75 +++ arch/x86/include/asm/mshyperv.h | 9 + drivers/firmware/efi/libstub/x86-stub.c | 57 +++ drivers/hv/Kconfig | 9 + drivers/hv/Makefile | 3 +- drivers/hv/hv_common.c | 3 +- drivers/hv/hv_vsm.h | 19 + drivers/hv/hv_vsm_boot.c | 630 ++++++++++++++++++++++++ drivers/hv/hv_vsm_securekernel.c | 188 +++++++ include/hyperv/hvgdk_mini.h | 46 ++ include/hyperv/vsm.h | 43 ++ 14 files changed, 1376 insertions(+), 2 deletions(-) create mode 100644 arch/x86/hyperv/hv_vtl_vsm.c create mode 100644 drivers/hv/hv_vsm.h create mode 100644 drivers/hv/hv_vsm_boot.c create mode 100644 drivers/hv/hv_vsm_securekernel.c create mode 100644 include/hyperv/vsm.h base-commit: be0cfab740e58b70047ef6e7e3d578f00ed5d258 -- 2.34.1

