lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAOLK0pyv8a2ou3THn9h71BQT2ZXfaRQdzNjZAmMxzs8TYFnw=w@mail.gmail.com>
Date:   Mon, 17 Dec 2018 22:08:49 +0800
From:   Tianyu Lan <lantianyu1986@...il.com>
To:     Paolo Bonzini <pbonzini@...hat.com>
Cc:     Lan Tianyu <Tianyu.Lan@...rosoft.com>,
        Radim Krcmar <rkrcmar@...hat.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, bp@...en8.de,
        "H. Peter Anvin" <hpa@...or.com>,
        "the arch/x86 maintainers" <x86@...nel.org>,
        kvm <kvm@...r.kernel.org>,
        "linux-kernel@...r kernel org" <linux-kernel@...r.kernel.org>,
        michael.h.kelley@...rosoft.com, kys@...rosoft.com,
        vkuznets@...hat.com
Subject: Re: [PATCH V2 1/2] KVM/VMX: Check ept_pointer before flushing ept tlb

On Fri, Dec 14, 2018 at 7:00 PM Paolo Bonzini <pbonzini@...hat.com> wrote:
>
> On 06/12/18 08:34, lantianyu1986@...il.com wrote:
> > From: Lan Tianyu <Tianyu.Lan@...rosoft.com>
> >
> > This patch is to initialize ept_pointer to INVALID_PAGE and check it
> > before flushing ept tlb. If ept_pointer is invalid, bypass the flush
> > request.
> >
> > Signed-off-by: Lan Tianyu <Tianyu.Lan@...rosoft.com>
>
> Can you explain better *why* this patch is needed?
Yes, hypercall still maybe called when ept_pointers aren't
initialized. Such case happens
during guest boot up when BP works at first and APs aren't activated.

>  Also, should vmx->ept_pointer be cleared at reset time, rather than vCPU creation?
>

Yes, that make sense. Thanks for suggestion.

> Thanks,
>
> Paolo
>
> > ---
> >  arch/x86/kvm/vmx.c | 13 +++++++++++--
> >  1 file changed, 11 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> > index c379d0bfdcba..6577ec8cbb0f 100644
> > --- a/arch/x86/kvm/vmx.c
> > +++ b/arch/x86/kvm/vmx.c
> > @@ -1582,11 +1582,18 @@ static int vmx_hv_remote_flush_tlb(struct kvm *kvm)
> >       /*
> >        * FLUSH_GUEST_PHYSICAL_ADDRESS_SPACE hypercall needs the address of the
> >        * base of EPT PML4 table, strip off EPT configuration information.
> > +      * If ept_pointer is invalid pointer, bypass the flush request.
> >        */
> >       if (to_kvm_vmx(kvm)->ept_pointers_match != EPT_POINTERS_MATCH) {
> > -             kvm_for_each_vcpu(i, vcpu, kvm)
> > +             kvm_for_each_vcpu(i, vcpu, kvm) {
> > +                     u64 ept_pointer = to_vmx(vcpu)->ept_pointer;
> > +
> > +                     if (!VALID_PAGE(ept_pointer))
> > +                             continue;
> > +
> >                       ret |= hyperv_flush_guest_mapping(
> > -                             to_vmx(kvm_get_vcpu(kvm, i))->ept_pointer & PAGE_MASK);
> > +                             ept_pointer & PAGE_MASK);
> > +             }
> >       } else {
> >               ret = hyperv_flush_guest_mapping(
> >                               to_vmx(kvm_get_vcpu(kvm, 0))->ept_pointer & PAGE_MASK);
> > @@ -11614,6 +11621,8 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id)
> >       vmx->pi_desc.nv = POSTED_INTR_VECTOR;
> >       vmx->pi_desc.sn = 1;
> >
> > +     vmx->ept_pointer = INVALID_PAGE;
> > +
> >       return &vmx->vcpu;
> >
> >  free_vmcs:
> >
>


-- 
Best regards
Tianyu Lan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ