Skip to content

Commit f8acb24

Browse files
kelleymhliuw
authored andcommitted
x86/hyperv: Block root partition functionality in a Confidential VM
Hyper-V should never specify a VM that is a Confidential VM and also running in the root partition. Nonetheless, explicitly block such a combination to guard against a compromised Hyper-V maliciously trying to exploit root partition functionality in a Confidential VM to expose Confidential VM secrets. No known bug is being fixed, but the attack surface for Confidential VMs on Hyper-V is reduced. Signed-off-by: Michael Kelley <mikelley@microsoft.com> Link: https://lore.kernel.org/r/1678894453-95392-1-git-send-email-mikelley@microsoft.com Signed-off-by: Wei Liu <wei.liu@kernel.org>
1 parent 1eb65c8 commit f8acb24

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

arch/x86/kernel/cpu/mshyperv.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -358,12 +358,16 @@ static void __init ms_hyperv_init_platform(void)
358358
* To mirror what Windows does we should extract CPU management
359359
* features and use the ReservedIdentityBit to detect if Linux is the
360360
* root partition. But that requires negotiating CPU management
361-
* interface (a process to be finalized).
361+
* interface (a process to be finalized). For now, use the privilege
362+
* flag as the indicator for running as root.
362363
*
363-
* For now, use the privilege flag as the indicator for running as
364-
* root.
364+
* Hyper-V should never specify running as root and as a Confidential
365+
* VM. But to protect against a compromised/malicious Hyper-V trying
366+
* to exploit root behavior to expose Confidential VM memory, ignore
367+
* the root partition setting if also a Confidential VM.
365368
*/
366-
if (cpuid_ebx(HYPERV_CPUID_FEATURES) & HV_CPU_MANAGEMENT) {
369+
if ((ms_hyperv.priv_high & HV_CPU_MANAGEMENT) &&
370+
!(ms_hyperv.priv_high & HV_ISOLATION)) {
367371
hv_root_partition = true;
368372
pr_info("Hyper-V: running as root partition\n");
369373
}

0 commit comments

Comments
 (0)