[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <jpg1spmsugn.fsf@linux.bootlegged.copy>
Date: Tue, 11 Jul 2017 14:24:08 -0400
From: Bandan Das <bsd@...hat.com>
To: David Hildenbrand <david@...hat.com>
Cc: kvm@...r.kernel.org, pbonzini@...hat.com,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v4 3/3] KVM: nVMX: Emulate EPTP switching for the L1 hypervisor
Bandan Das <bsd@...hat.com> writes:
....
>>> + /*
>>> + * If the (L2) guest does a vmfunc to the currently
>>> + * active ept pointer, we don't have to do anything else
>>> + */
>>> + if (vmcs12->ept_pointer != address) {
>>> + if (address >> cpuid_maxphyaddr(vcpu) ||
>>> + !IS_ALIGNED(address, 4096))
>>
>> Couldn't the pfn still be invalid and make kvm_mmu_reload() fail?
>> (triggering a KVM_REQ_TRIPLE_FAULT)
>
> If there's a triple fault, I think it's a good idea to inject it
> back. Basically, there's no need to take care of damage control
> that L1 is intentionally doing.
>
>>> + goto fail;
>>> + kvm_mmu_unload(vcpu);
>>> + vmcs12->ept_pointer = address;
>>> + kvm_mmu_reload(vcpu);
>>
>> I was thinking about something like this:
>>
>> kvm_mmu_unload(vcpu);
>> old = vmcs12->ept_pointer;
>> vmcs12->ept_pointer = address;
>> if (kvm_mmu_reload(vcpu)) {
>> /* pointer invalid, restore previous state */
>> kvm_clear_request(KVM_REQ_TRIPLE_FAULT, vcpu);
>> vmcs12->ept_pointer = old;
>> kvm_mmu_reload(vcpu);
>> goto fail;
>> }
>>
>> The you can inherit the checks from mmu_check_root().
Actually, thinking about this a bit more, I agree with you. Any fault
with a vmfunc operation should end with a vmfunc vmexit, so this
is a good thing to have. Thank you for this idea! :)
Bandan
Powered by blists - more mailing lists