On 04/05/2018 20:37, Junaid Shahid wrote: > If the PCIDE bit is not set in CR4, then the MSb of CR3 is a reserved > bit. If the guest tries to set it, that should cause a #GP fault. So > mask out the bit only when the PCIDE bit is set. > > Signed-off-by: Junaid Shahid <junaids@xxxxxxxxxx> > --- > arch/x86/kvm/x86.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 847ce7f0a2c8..5a19d220a9c3 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -845,7 +845,10 @@ int kvm_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3) > unsigned long old_cr3 = kvm_read_cr3(vcpu); > > #ifdef CONFIG_X86_64 > - cr3 &= ~CR3_PCID_INVD; > + bool pcid_enabled = kvm_read_cr4_bits(vcpu, X86_CR4_PCIDE); > + > + if (pcid_enabled) > + cr3 &= ~CR3_PCID_INVD; > #endif > > if (cr3 == old_cr3 && !pdptrs_changed(vcpu)) { > Queued, thanks. Paolo