Re: [kvm-unit-tests PATCH] X86: Set up EPT before running vmx_pf_exception_test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 02, 2022 at 08:41:47PM +0000, Sean Christopherson wrote:
> On Fri, Jul 15, 2022, Yu Zhang wrote:
> > Although currently vmx_pf_exception_test can succeed, its
> > success is actually because we are using identical mappings
> > in the page tables and EB.PF is not set by L1. In practice,
> > the #PFs shall be expected by L1, if it is using shadowing
> > for L2.
> 
> I'm a bit lost.  Is there an actual failure somewhere?  AFAICT, this passes when
> run as L1 or L2, with or without EPT enabled.

Thanks for your reply, Sean.

There's no failure. But IMHO, there should have been(for the
vmx_pf_exception_test, not the access test) -  L1 shall expect
#PF induced VM exits, when it is using shadow for L2.

B.R.
Yu


> > So just set up the EPT, and clear the EB.PT, then L1 has the
> > right to claim a failure if a #PF is encountered.
> > 
> > Signed-off-by: Yu Zhang <yu.c.zhang@xxxxxxxxxxxxxxx>
> > ---
> >  x86/vmx_tests.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c > > index
4d581e7..cc90611 100644
> > --- a/x86/vmx_tests.c
> > +++ b/x86/vmx_tests.c
> > @@ -10639,6 +10639,17 @@ static void __vmx_pf_exception_test(invalidate_tlb_t inv_fn, void *data)
> >  
> >  static void vmx_pf_exception_test(void)
> >  {
> > +	u32 eb;
> > +
> > +	if (setup_ept(false)) {
> > +		printf("EPT not supported.\n");
> > +		return;
> > +	}
> > +
> > +	eb = vmcs_read(EXC_BITMAP);
> > +	eb &= ~(1 << PF_VECTOR);
> > +	vmcs_write(EXC_BITMAP, eb);
> > +
> >  	__vmx_pf_exception_test(NULL, NULL);
> >  }
> >  
> > -- 
> > 2.25.1
> > 



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux