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

From: Paolo Bonzini
Date: Thu Nov 21 2019 - 11:08:18 EST


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.

Thanks,

Paolo