From: Xin Li <[email protected]>

Prevent L1 from accessing the ORIGINAL_EVENT_DATA and INJECTED_EVENT_DATA
VMCS fields via VMREAD or VMWRITE when FRED support is disabled or not
present in KVM.

Signed-off-by: Xin Li <[email protected]>
Signed-off-by: Sohil Mehta <[email protected]>
---
v10:
 - Split out of "KVM: nVMX: Guard SHADOW_FIELD_R[OW] macros with VMX
   feature checks" and renamed (Sean).
---
 arch/x86/kvm/vmx/vmcs12.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/kvm/vmx/vmcs12.c b/arch/x86/kvm/vmx/vmcs12.c
index 837cb3d568c3..67c730e31465 100644
--- a/arch/x86/kvm/vmx/vmcs12.c
+++ b/arch/x86/kvm/vmx/vmcs12.c
@@ -222,6 +222,9 @@ static __init bool cpu_has_vmcs12_field(unsigned int idx)
        case HOST_SSP:
        case HOST_INTR_SSP_TABLE:
                return cpu_has_load_cet_ctrl();
+       VMCS12_CASE64(ORIGINAL_EVENT_DATA):
+       VMCS12_CASE64(INJECTED_EVENT_DATA):
+               return cpu_has_vmx_fred();
 
        /* KVM always emulates PML and the VMX preemption timer in software. */
        case GUEST_PML_INDEX:
-- 
2.43.0


Reply via email to