Re: [PATCH 5.10 048/104] KVM: x86: cleanup CR3 reserved bits checks
From: Pavel Machek
Date: Mon Feb 15 2021 - 13:48:26 EST
Hi!
> [ Upstream commit c1c35cf78bfab31b8cb455259524395c9e4c7cd6 ]
>
> If not in long mode, the low bits of CR3 are reserved but not enforced to
> be zero, so remove those checks. If in long mode, however, the MBZ bits
> extend down to the highest physical address bit of the guest, excluding
> the encryption bit.
>
> Make the checks consistent with the above, and match them between
> nested_vmcb_checks and KVM_SET_SREGS.
> +++ b/arch/x86/kvm/x86.c
> @@ -9558,6 +9558,8 @@ static int kvm_valid_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
> if (!(sregs->cr4 & X86_CR4_PAE)
> || !(sregs->efer & EFER_LMA))
> return -EINVAL;
> + if (sregs->cr3 & vcpu->arch.cr3_lm_rsvd_bits)
> + return false;
> } else {
Function has different return type between 5.10 and 5.11, so this
needs fixing.
Best regards,
Pavel
--
http://www.livejournal.com/~pavelmachek
Attachment:
signature.asc
Description: Digital signature