On Tue, Feb 14, 2023 at 02:18:59PM +0800, Chao Gao wrote: >>> > bool skip_tlb_flush = false; >>> > @@ -1254,7 +1262,7 @@ int kvm_set_cr3(struct kvm_vcpu *vcpu, >>> > unsigned long cr3) >>> > * stuff CR3, e.g. for RSM emulation, and there is no guarantee >>> > that >>> > * the current vCPU mode is accurate. >>> > */ >>> > - if (kvm_vcpu_is_illegal_gpa(vcpu, cr3)) >>> > + if (!kvm_is_valid_cr3(vcpu, cr3)) >>> >>> There are other call sites of kvm_vcpu_is_illegal_gpa() to validate >>> cr3. >>> Do you need to modify them? >> >>I don't think so. Others are for gpa validation, no need to change. >>Here is for CR3. > >how about the call in kvm_is_valid_sregs()? if you don't change it, when >user space VMM tries to set a CR3 with any LAM bits, KVM thinks the CR3 >is illegal and returns an error. To me it means live migration probably >is broken. > >And the call in nested_vmx_check_host_state()? L1 VMM should be allowed to >program a CR3 with LAM bits set to VMCS's HOST_CR3 field. Actually, it >is exactly what this patch 6 is doing. Please disregard "Actually, it is exactly what this patch 6 is doing". My brain just disconnected.