Skip to content

Commit a512177

Browse files
committed
KVM: x86: do mask out upper bits of PAE CR3
This reverts the change of commit f85c758, as the behavior it modified was intended. The VM is running in 32-bit PAE mode, and Table 4-7 of the Intel manual says: Table 4-7. Use of CR3 with PAE Paging Bit Position(s) Contents 4:0 Ignored 31:5 Physical address of the 32-Byte aligned page-directory-pointer table used for linear-address translation 63:32 Ignored (these bits exist only on processors supporting the Intel-64 architecture) To placate the static checker, write the mask explicitly as an unsigned long constant instead of using a 32-bit unsigned constant. Cc: Dan Carpenter <[email protected]> Fixes: f85c758 Signed-off-by: Paolo Bonzini <[email protected]>
1 parent fdeaf7e commit a512177

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

arch/x86/kvm/x86.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -597,8 +597,8 @@ bool pdptrs_changed(struct kvm_vcpu *vcpu)
597597
(unsigned long *)&vcpu->arch.regs_avail))
598598
return true;
599599

600-
gfn = (kvm_read_cr3(vcpu) & ~31ul) >> PAGE_SHIFT;
601-
offset = (kvm_read_cr3(vcpu) & ~31ul) & (PAGE_SIZE - 1);
600+
gfn = (kvm_read_cr3(vcpu) & 0xffffffe0ul) >> PAGE_SHIFT;
601+
offset = (kvm_read_cr3(vcpu) & 0xffffffe0ul) & (PAGE_SIZE - 1);
602602
r = kvm_read_nested_guest_page(vcpu, gfn, pdpte, offset, sizeof(pdpte),
603603
PFERR_USER_MASK | PFERR_WRITE_MASK);
604604
if (r < 0)

0 commit comments

Comments
 (0)