[lkml]   [2021]   [Oct]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH 1/4] KVM: X86: Fix tlb flush for tdp in kvm_invalidate_pcid()

On 2021/10/19 23:25, Sean Christopherson wrote:

> /*
> * MOV CR3 and INVPCID are usually not intercepted when using TDP, but
> * this is reachable when running EPT=1 and unrestricted_guest=0, and
> * also via the emulator. KVM's TDP page tables are not in the scope of
> * the invalidation, but the guest's TLB entries need to be flushed as
> * the CPU may have cached entries in its TLB for the target PCID.
> */

Thanks! It is a better description.

I just read some interception policy in vmx.c, if EPT=1 but vmx_need_pf_intercept()
return true for some reasons/configs, #PF is intercepted. But CR3 write is not
intercepted, which means there will be an EPT fault _after_ (IIUC) the CR3 write if
the GPA of the new CR3 exceeds the guest maxphyaddr limit. And kvm queues a fault to
the guest which is also _after_ the CR3 write, but the guest expects the fault before
the write.

IIUC, it can be fixed by intercepting CR3 write or reversing the CR3 write in EPT
violation handler.


 \ /
  Last update: 2021-10-20 11:54    [W:0.096 / U:0.440 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site