Skip to contentSkip to conversation

KVM: x86: Deplete Paolo's brown paper bag supply by one

PATCH In review Sean Christopherson 2 participants 2 messages Apr 6, 2022 – Apr 7, 2022

Subsystems (3)
lore
Share & tools
lore

Sean Christopherson

author maintainer
#0 lore raw

PATCH 1/1 KVM: x86: Deplete Paolo's brown paper bag supply by one

Fix an inverted check on CR0.PG when computing the cpu_role, the MMU is direct and all CR4 bits ignored if paging is disabled, not enabled.

Fixes d73678dc11ec ("KVM: x86/mmu: split cpu_role from mmu_role")

---

I haven't done much testing on the rest of the MMU role patches, this just popped up in very, very basic testing ;-) I assume this will be squashed, hence the snarky shortlog.

 arch/x86/kvm/mmu/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/mmu/mmu.c +1 -1
index e41d7bba7a65..ab24fc161bac 100644
@@ -4699,7 +4699,7 @@ kvm_calc_cpu_role(struct kvm_vcpu *vcpu, const struct kvm_mmu_role_regs *regs)
 	role.base.smm = is_smm(vcpu);
 	role.base.guest_mode = is_guest_mode(vcpu);
 
-	if (____is_cr0_pg(regs)) {
+	if (!____is_cr0_pg(regs)) {
 		role.base.direct = 1;
 		return role;
 	}

base-commit: 56ba4b488353a8925b30367d72e41d1996c23554

Signature · 1 line
2.35.1.1094.g7c7d902a7c-goog
maintainer
#1 lore raw
Quoted 10 lines · Sean Christopherson

Fix an inverted check on CR0.PG when computing the cpu_role, the MMU is direct and all CR4 bits ignored if paging is disabled, not enabled.

Fixes d73678dc11ec ("KVM: x86/mmu: split cpu_role from mmu_role")

---

I haven't done much testing on the rest of the MMU role patches, this just popped up in very, very basic testing ;-) I assume this will be squashed, hence the snarky shortlog.

It certainly got my attention... squashed, thanks. :)

Paolo

Quoted 18 lines
  arch/x86/kvm/mmu/mmu.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/mmu/mmu.c +1 -1
index e41d7bba7a65..ab24fc161bac 100644
@@ -4699,7 +4699,7 @@ kvm_calc_cpu_role(struct kvm_vcpu *vcpu, const struct kvm_mmu_role_regs *regs)
  	role.base.smm = is_smm(vcpu);
  	role.base.guest_mode = is_guest_mode(vcpu);
 
-	if (____is_cr0_pg(regs)) {
+	if (!____is_cr0_pg(regs)) {
  		role.base.direct = 1;
  		return role;
  	}

base-commit: 56ba4b488353a8925b30367d72e41d1996c23554