Re: [PATCH v3 4/6] KVM: x86: Add support for RDMSR/WRMSRNS w/ immediate on Intel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 9/1/2025 12:13 PM, Xiaoyao Li wrote:
On 8/6/2025 4:22 AM, Sean Christopherson wrote:
+static int handle_rdmsr_imm(struct kvm_vcpu *vcpu)
+{
+    return kvm_emulate_rdmsr_imm(vcpu, vmx_get_exit_qual(vcpu),
+                     vmx_get_msr_imm_reg(vcpu));
+}
+
+static int handle_wrmsr_imm(struct kvm_vcpu *vcpu)
+{
+    return kvm_emulate_wrmsr_imm(vcpu, vmx_get_exit_qual(vcpu),
+                     vmx_get_msr_imm_reg(vcpu));
+}

We need to inject #UD for !guest_cpu_has(X86_FEATURE_MSR_IMM)


Indeed.

There is a virtualization hole of this feature for the accesses to the MSRs not
intercepted. IIUIC, there is no other control in VMX for this feature. If the
feature is supported in hardware, the guest will succeed when it accesses to the
MSRs not intercepted even when the feature is not exposed to the guest, but the
guest will get #UD when access to the MSRs intercepted if KVM injects #UD.

But I guess this is the guest's fault by not following the CPUID, KVM should
still follow the spec?




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux