lkml.org 
[lkml]   [2021]   [Sep]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] KVM: nVMX: Reset vmxon_ptr upon VMXOFF emulation.
On Thu, Sep 09, 2021, Yu Zhang wrote:
> From: Vitaly Kuznetsov <vkuznets@redhat.com>
>
> Currently, 'vmx->nested.vmxon_ptr' is not reset upon VMXOFF
> emulation. This is not a problem per se as we never access
> it when !vmx->nested.vmxon. But this should be done to avoid
> any issue in the future.
>
> Also, initialize the vmxon_ptr when vcpu is created.
>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
> Signed-off-by: Yu Zhang <yu.c.zhang@linux.intel.com>
> ---
> arch/x86/kvm/vmx/nested.c | 1 +
> arch/x86/kvm/vmx/vmx.c | 1 +
> 2 files changed, 2 insertions(+)
>
> diff --git a/arch/x86/kvm/vmx/nested.c b/arch/x86/kvm/vmx/nested.c
> index 90f34f12f883..e4260f67caac 100644
> --- a/arch/x86/kvm/vmx/nested.c
> +++ b/arch/x86/kvm/vmx/nested.c
> @@ -289,6 +289,7 @@ static void free_nested(struct kvm_vcpu *vcpu)
> kvm_clear_request(KVM_REQ_GET_NESTED_STATE_PAGES, vcpu);
>
> vmx->nested.vmxon = false;
> + vmx->nested.vmxon_ptr = -1ull;

Looks like the "-1ull" comes from current_vmptr and friends, but using INVALID_GPA
is more appropriate. It's the same value, but less arbitrary. The other usage of
-1ull for guest physical addresses should really be cleaned up, too.

\
 
 \ /
  Last update: 2021-09-09 18:21    [W:0.039 / U:3.460 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site