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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200317053327.GR24267@linux.intel.com>
Date:   Mon, 16 Mar 2020 22:33:27 -0700
From:   Sean Christopherson <sean.j.christopherson@...el.com>
To:     Vitaly Kuznetsov <vkuznets@...hat.com>
Cc:     Paolo Bonzini <pbonzini@...hat.com>,
        Wanpeng Li <wanpengli@...cent.com>,
        Jim Mattson <jmattson@...gle.com>,
        Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org, Xiaoyao Li <xiaoyao.li@...el.com>
Subject: Re: [PATCH 01/10] KVM: nVMX: Move reflection check into
 nested_vmx_reflect_vmexit()

On Fri, Mar 13, 2020 at 01:12:33PM +0100, Vitaly Kuznetsov wrote:
> Sean Christopherson <sean.j.christopherson@...el.com> writes:
> 
> > Move the call to nested_vmx_exit_reflected() from vmx_handle_exit() into
> > nested_vmx_reflect_vmexit() and change the semantics of the return value
> > for nested_vmx_reflect_vmexit() to indicate whether or not the exit was
> > reflected into L1.  nested_vmx_exit_reflected() and
> > nested_vmx_reflect_vmexit() are intrinsically tied together, calling one
> > without simultaneously calling the other makes little sense.
> >
> > No functional change intended.
> >
> > Signed-off-by: Sean Christopherson <sean.j.christopherson@...el.com>
> > ---
> >  arch/x86/kvm/vmx/nested.h | 16 +++++++++++-----
> >  arch/x86/kvm/vmx/vmx.c    |  4 ++--
> >  2 files changed, 13 insertions(+), 7 deletions(-)
> >
> > diff --git a/arch/x86/kvm/vmx/nested.h b/arch/x86/kvm/vmx/nested.h
> > index 21d36652f213..6bc379cf4755 100644
> > --- a/arch/x86/kvm/vmx/nested.h
> > +++ b/arch/x86/kvm/vmx/nested.h
> > @@ -72,12 +72,16 @@ static inline bool nested_ept_ad_enabled(struct kvm_vcpu *vcpu)
> >  }
> >  
> >  /*
> > - * Reflect a VM Exit into L1.
> > + * Conditionally reflect a VM-Exit into L1.  Returns %true if the VM-Exit was
> > + * reflected into L1.
> >   */
> > -static inline int nested_vmx_reflect_vmexit(struct kvm_vcpu *vcpu,
> > -					    u32 exit_reason)
> > +static inline bool nested_vmx_reflect_vmexit(struct kvm_vcpu *vcpu,
> > +					     u32 exit_reason)
> >  {
> > -	u32 exit_intr_info = vmcs_read32(VM_EXIT_INTR_INFO);
> > +	u32 exit_intr_info;
> > +
> > +	if (!nested_vmx_exit_reflected(vcpu, exit_reason))
> > +		return false;
> 
> (unrelated to your patch)
> 
> It's probably just me but 'nested_vmx_exit_reflected()' name always
> makes me thinkg 'the vmexit WAS [already] reflected' and not 'the vmexit
> NEEDS to be reflected'. 'nested_vmx_exit_needs_reflecting()' maybe?

Not just you.  It'd be nice if the name some how reflected (ha) that the
logic is mostly based on whether or not L1 expects the exit, with a few
exceptions.  E.g. something like

	if (!l1_expects_vmexit(...) && !is_system_vmexit(...))
		return false;

The downside of that is the logic is split, which is probably a net loss?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ