Skip to contentSkip to conversation

x86/vvmx: don't enable vmcs shadowing for nested guests

PATCH In review Sergey Dyasli 3 participants 3 messages Oct 23, 2017 – Nov 2, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/vvmx: don't enable vmcs shadowing for nested guests

Running "./xtf_runner vvmx" in L1 Xen under L0 Xen produces the following result on H/W with VMCS shadowing:

Test: vmxon
Failure in test_vmxon_in_root_cpl0()
Expected 0x8200000f: VMfailValid(15) VMXON_IN_ROOT
Got 0x82004400: VMfailValid(17408) <unknown>
Test result: FAILURE

This happens because SDM allows vmentries with enabled VMCS shadowing VM-execution control and VMCS link pointer value of ~0ull. But results of a nested VMREAD are undefined in such cases.

Fix this by not copying the value of VMCS shadowing control from vmcs01 to vmcs02.

---
 xen/arch/x86/hvm/vmx/vvmx.c | 1 +
 1 file changed, 1 insertion(+)
xen/arch/x86/hvm/vmx/vvmx.c +1 -0
index dde02c076b..013d049f8a 100644
@@ -633,6 +633,7 @@ void nvmx_update_secondary_exec_control(struct vcpu *v,
                     SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY;
 
     host_cntrl &= ~apicv_bit;
+    host_cntrl &= ~SECONDARY_EXEC_ENABLE_VMCS_SHADOWING;
     shadow_cntrl = get_vvmcs(v, SECONDARY_VM_EXEC_CONTROL);
 
     /* No vAPIC-v support, so it shouldn't be set in vmcs12. */
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines

From: Sergey Dyasli [mailto:[email protected]]
Sent: Monday, October 23, 2017 5:33 PM

Running "./xtf_runner vvmx" in L1 Xen under L0 Xen produces the following result on H/W with VMCS shadowing:

Test: vmxon
Failure in test_vmxon_in_root_cpl0()
Expected 0x8200000f: VMfailValid(15) VMXON_IN_ROOT
Got 0x82004400: VMfailValid(17408) <unknown>
Test result: FAILURE

This happens because SDM allows vmentries with enabled VMCS shadowing
VM-execution control and VMCS link pointer value of ~0ull. But results of a nested VMREAD are undefined in such cases.

Quoted 4 lines

Fix this by not copying the value of VMCS shadowing control from vmcs01 to vmcs02.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
Quoted 17 lines · Kevin
Quoted 17 lines

From: Sergey Dyasli [mailto:[email protected]]
Sent: Monday, October 23, 2017 5:33 PM

Running "./xtf_runner vvmx" in L1 Xen under L0 Xen produces the following result on H/W with VMCS shadowing:

Test: vmxon
Failure in test_vmxon_in_root_cpl0()
Expected 0x8200000f: VMfailValid(15) VMXON_IN_ROOT
Got 0x82004400: VMfailValid(17408) <unknown>
Test result: FAILURE

This happens because SDM allows vmentries with enabled VMCS shadowing
VM-execution control and VMCS link pointer value of ~0ull. But results of a nested VMREAD are undefined in such cases.

Quoted 5 lines
Quoted 4 lines

Fix this by not copying the value of VMCS shadowing control from vmcs01 to vmcs02.

Pulled into x86-next

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel