Re: [PATCH] KVM: nVMX: Inject #GP when nested_vmx_get_vmptr() fails to read guest memory

From: Vitaly Kuznetsov
Date: Thu Jun 04 2020 - 11:33:36 EST


Sean Christopherson <sean.j.christopherson@xxxxxxxxx> writes:

> On Thu, Jun 04, 2020 at 04:40:52PM +0200, Paolo Bonzini wrote:
>> On 04/06/20 16:31, Vitaly Kuznetsov wrote:
>
> ...
>
>> > KVM could've handled the request correctly by going to userspace and
>> > performing I/O but there doesn't seem to be a good need for such requests
>> > in the first place. Sane guests should not call VMXON/VMPTRLD/VMCLEAR with
>> > anything but normal memory. Just inject #GP to find insane ones.
>> >

...

>>
>> looks good but we need to do the same in handle_vmread, handle_vmwrite,
>> handle_invept and handle_invvpid. Which probably means adding something
>> like nested_inject_emulation_fault to commonize the inner "if".
>
> Can we just kill the guest already instead of throwing more hacks at this
> and hoping something sticks? We already have one in
> kvm_write_guest_virt_system...
>
> commit 541ab2aeb28251bf7135c7961f3a6080eebcc705
> Author: Fuqian Huang <huangfq.daxian@xxxxxxxxx>
> Date: Thu Sep 12 12:18:17 2019 +0800
>
> KVM: x86: work around leak of uninitialized stack contents
>

Oh I see...

[...]

Let's get back to 'vm_bugged' idea then?

https://lore.kernel.org/kvm/87muadnn1t.fsf@xxxxxxxxxxxxxxxxxxxx/

--
Vitaly