Skip to content

Commit cbaff87

Browse files
committed
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull kvm fixes from Paolo Bonzini: "Another latent bug related to PCID, an out-of-bounds access, and a submaintainer change being finally made official" * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: MAINTAINERS: Add Paul Mackerras as maintainer for KVM/powerpc KVM: nVMX: fix guest CR4 loading when emulating L2 to L1 exit KVM: MMU: always terminate page walks at level 1 KVM: nVMX: update last_nonleaf_level when initializing nested EPT
2 parents 73a752c + 8a60aea commit cbaff87

4 files changed

Lines changed: 12 additions & 10 deletions

File tree

‎MAINTAINERS‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7571,7 +7571,7 @@ F: arch/mips/include/asm/kvm*
75717571
F: arch/mips/kvm/
75727572

75737573
KERNEL VIRTUAL MACHINE FOR POWERPC (KVM/powerpc)
7574-
M: Alexander Graf <agraf@suse.com>
7574+
M: Paul Mackerras <paulus@ozlabs.org>
75757575
L: kvm-ppc@vger.kernel.org
75767576
W: http://www.linux-kvm.org/
75777577
T: git git://github.com/agraf/linux-2.6.git

‎arch/x86/kvm/mmu.c‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3973,20 +3973,20 @@ static bool sync_mmio_spte(struct kvm_vcpu *vcpu, u64 *sptep, gfn_t gfn,
39733973
static inline bool is_last_gpte(struct kvm_mmu *mmu,
39743974
unsigned level, unsigned gpte)
39753975
{
3976-
/*
3977-
* PT_PAGE_TABLE_LEVEL always terminates. The RHS has bit 7 set
3978-
* iff level <= PT_PAGE_TABLE_LEVEL, which for our purpose means
3979-
* level == PT_PAGE_TABLE_LEVEL; set PT_PAGE_SIZE_MASK in gpte then.
3980-
*/
3981-
gpte |= level - PT_PAGE_TABLE_LEVEL - 1;
3982-
39833976
/*
39843977
* The RHS has bit 7 set iff level < mmu->last_nonleaf_level.
39853978
* If it is clear, there are no large pages at this level, so clear
39863979
* PT_PAGE_SIZE_MASK in gpte if that is the case.
39873980
*/
39883981
gpte &= level - mmu->last_nonleaf_level;
39893982

3983+
/*
3984+
* PT_PAGE_TABLE_LEVEL always terminates. The RHS has bit 7 set
3985+
* iff level <= PT_PAGE_TABLE_LEVEL, which for our purpose means
3986+
* level == PT_PAGE_TABLE_LEVEL; set PT_PAGE_SIZE_MASK in gpte then.
3987+
*/
3988+
gpte |= level - PT_PAGE_TABLE_LEVEL - 1;
3989+
39903990
return gpte & PT_PAGE_SIZE_MASK;
39913991
}
39923992

@@ -4555,6 +4555,7 @@ void kvm_init_shadow_ept_mmu(struct kvm_vcpu *vcpu, bool execonly,
45554555

45564556
update_permission_bitmask(vcpu, context, true);
45574557
update_pkru_bitmask(vcpu, context, true);
4558+
update_last_nonleaf_level(vcpu, context);
45584559
reset_rsvds_bits_mask_ept(vcpu, context, execonly);
45594560
reset_ept_shadow_zero_bits_mask(vcpu, context, execonly);
45604561
}

‎arch/x86/kvm/paging_tmpl.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,10 +334,11 @@ static int FNAME(walk_addr_generic)(struct guest_walker *walker,
334334
--walker->level;
335335

336336
index = PT_INDEX(addr, walker->level);
337-
338337
table_gfn = gpte_to_gfn(pte);
339338
offset = index * sizeof(pt_element_t);
340339
pte_gpa = gfn_to_gpa(table_gfn) + offset;
340+
341+
BUG_ON(walker->level < 1);
341342
walker->table_gfn[walker->level - 1] = table_gfn;
342343
walker->pte_gpa[walker->level - 1] = pte_gpa;
343344

‎arch/x86/kvm/vmx.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11297,7 +11297,7 @@ static void load_vmcs12_host_state(struct kvm_vcpu *vcpu,
1129711297

1129811298
/* Same as above - no reason to call set_cr4_guest_host_mask(). */
1129911299
vcpu->arch.cr4_guest_owned_bits = ~vmcs_readl(CR4_GUEST_HOST_MASK);
11300-
kvm_set_cr4(vcpu, vmcs12->host_cr4);
11300+
vmx_set_cr4(vcpu, vmcs12->host_cr4);
1130111301

1130211302
nested_ept_uninit_mmu_context(vcpu);
1130311303

0 commit comments

Comments
 (0)