[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CALMp9eTaLwj7kXgvACFQ_42+F7pnOvaAd02_2o4tG2fX5+JQaQ@mail.gmail.com>
Date: Thu, 16 Apr 2020 14:33:54 -0700
From: Jim Mattson <jmattson@...gle.com>
To: Sean Christopherson <sean.j.christopherson@...el.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Joerg Roedel <joro@...tes.org>, kvm list <kvm@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>,
Rick Edgecombe <rick.p.edgecombe@...el.com>
Subject: Re: [PATCH 1/2] KVM: x86/mmu: Set @writable to false for non-visible
accesses by L2
On Wed, Apr 15, 2020 at 2:44 PM Sean Christopherson
<sean.j.christopherson@...el.com> wrote:
>
> Explicitly set @writable to false in try_async_pf() if the GFN->PFN
> translation is short-circuited due to the requested GFN not being
> visible to L2.
>
> Leaving @writable ('map_writable' in the callers) uninitialized is ok
> in that it's never actually consumed, but one has to track it all the
> way through set_spte() being short-circuited by set_mmio_spte() to
> understand that the uninitialized variable is benign, and relying on
> @writable being ignored is an unnecessary risk. Explicitly setting
> @writable also aligns try_async_pf() with __gfn_to_pfn_memslot().
>
> Jim Mattson <jmattson@...gle.com>
Go ahead and preface the above with Reviewed-by:
> Signed-off-by: Sean Christopherson <sean.j.christopherson@...el.com>
> ---
> arch/x86/kvm/mmu/mmu.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index c6ea6032c222..6d6cb9416179 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -4090,6 +4090,7 @@ static bool try_async_pf(struct kvm_vcpu *vcpu, bool prefault, gfn_t gfn,
> */
> if (is_guest_mode(vcpu) && !kvm_is_visible_gfn(vcpu->kvm, gfn)) {
> *pfn = KVM_PFN_NOSLOT;
> + *writable = false;
> return false;
> }
>
> --
> 2.26.0
>
Powered by blists - more mailing lists