From: Paolo Bonzini Date: Sat, 14 Sep 2024 13:56:06 +0000 (-0400) Subject: Merge tag 'kvm-x86-vmx-6.12' of https://github.com/kvm-x86/linux into HEAD X-Git-Url: https://repo.jachan.dev/J-linux.git/commitdiff_plain/3f8df6285271d9d8f17d733433e5213a63b83a0b Merge tag 'kvm-x86-vmx-6.12' of https://github.com/kvm-x86/linux into HEAD KVM VMX changes for 6.12: - Set FINAL/PAGE in the page fault error code for EPT Violations if and only if the GVA is valid. If the GVA is NOT valid, there is no guest-side page table walk and so stuffing paging related metadata is nonsensical. - Fix a bug where KVM would incorrectly synthesize a nested VM-Exit instead of emulating posted interrupt delivery to L2. - Add a lockdep assertion to detect unsafe accesses of vmcs12 structures. - Harden eVMCS loading against an impossible NULL pointer deref (really truly should be impossible). - Minor SGX fix and a cleanup. --- 3f8df6285271d9d8f17d733433e5213a63b83a0b diff --cc arch/x86/kvm/x86.c index 0c1d54d9ef45,34b52b49f5e6..83fe0a78146f --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@@ -1954,11 -1928,19 +1954,11 @@@ int __kvm_get_msr(struct kvm_vcpu *vcpu static int kvm_get_msr_ignored_check(struct kvm_vcpu *vcpu, u32 index, u64 *data, bool host_initiated) { - int ret = __kvm_get_msr(vcpu, index, data, host_initiated); - - if (ret == KVM_MSR_RET_INVALID) { - /* Unconditionally clear *data for simplicity */ - *data = 0; - if (kvm_msr_ignored_check(index, 0, false)) - ret = 0; - } - - return ret; + return kvm_do_msr_access(vcpu, index, data, host_initiated, MSR_TYPE_R, + __kvm_get_msr); } - static int kvm_get_msr_with_filter(struct kvm_vcpu *vcpu, u32 index, u64 *data) + int kvm_get_msr_with_filter(struct kvm_vcpu *vcpu, u32 index, u64 *data) { if (!kvm_msr_allowed(vcpu, index, KVM_MSR_FILTER_READ)) return KVM_MSR_RET_FILTERED;