Skip to content

Commit 9757a5a

Browse files
committed
KVM: VMX: Initialize vmcs01.VM_EXIT_MSR_STORE_ADDR with list address
Initialize vmcs01.VM_EXIT_MSR_STORE_ADDR to point at the vCPU's msr_autostore list in anticipation of utilizing the auto-store functionality, and to harden KVM against stray reads to pfn 0 (or, in theory, a random pfn if the underlying CPU uses a complex scheme for encoding VMCS data). The MSR auto lists are supposed to be ignored if the associated COUNT VMCS field is '0', but leaving the ADDR field zero-initialized in memory is an unnecessary risk (albeit a minuscule risk) given that the cost is a single VMWRITE during vCPU creation. Tested-by: Manali Shukla <manali.shukla@amd.com> Link: https://patch.msgid.link/20251206001720.468579-44-seanjc@google.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent c3d6a72 commit 9757a5a

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

arch/x86/kvm/vmx/vmx.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4933,6 +4933,7 @@ static void init_vmcs(struct vcpu_vmx *vmx)
49334933
vmcs_write64(VM_FUNCTION_CONTROL, 0);
49344934

49354935
vmcs_write32(VM_EXIT_MSR_STORE_COUNT, 0);
4936+
vmcs_write64(VM_EXIT_MSR_STORE_ADDR, __pa(vmx->msr_autostore.val));
49364937
vmcs_write32(VM_EXIT_MSR_LOAD_COUNT, 0);
49374938
vmcs_write64(VM_EXIT_MSR_LOAD_ADDR, __pa(vmx->msr_autoload.host.val));
49384939
vmcs_write32(VM_ENTRY_MSR_LOAD_COUNT, 0);

0 commit comments

Comments
 (0)