Re: [PATCH v7 6/9] vmx: spp: Set up SPP paging table at vmentry/vmexit

From: Yang Weijiang
Date: Fri Nov 22 2019 - 10:23:14 EST


On Thu, Nov 21, 2019 at 05:08:07PM +0100, Paolo Bonzini wrote:
> On 21/11/19 16:22, Yang Weijiang wrote:
> > On Thu, Nov 21, 2019 at 11:18:48AM +0100, Paolo Bonzini wrote:
> >> On 19/11/19 09:49, Yang Weijiang wrote:
> >>> + if (spte & PT_SPP_MASK) {
> >>> + fault_handled = true;
> >>> + vcpu->run->exit_reason = KVM_EXIT_SPP;
> >>> + vcpu->run->spp.addr = gva;
> >>> + kvm_skip_emulated_instruction(vcpu);
> >>
> >> Do you really want to skip the current instruction? Who will do the write?
> >>
> > If the destination memory is SPP protected, the target memory is
> > expected unchanged on a "write op" in guest, so would like to skip current
> > instruction.
>
> This is how you are expecting SPP to be used, but another possibility is
> to unprotect and reenter the guest. In this case
> kvm_skip_emulated_instruction would be wrong (and once this decision is
> made, it would be very, very hard to change it).
>
> However, you clearly need a way to skip the instruction, and for that
> you could store the current instruction length in vcpu->run->spp. Then
> userspace can adjust RIP manually if desired.
>
Looks good to me, will add the length, thanks!
> Thanks,
>
> Paolo