RE: [PATCH kvm-unit-tests v2] access: check SMEP on prefetch pte path

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

 




> -----Original Message-----
> From: kvm-owner@xxxxxxxxxxxxxxx [mailto:kvm-owner@xxxxxxxxxxxxxxx] On
> Behalf Of Xiao Guangrong
> Sent: Friday, July 01, 2011 4:06 PM
> To: Yang, Wei Y
> Cc: avi@xxxxxxxxxx; kvm@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH kvm-unit-tests v2] access: check SMEP on prefetch pte
> path
> 
> On 06/29/2011 06:24 PM, Yang, Wei wrote:
> 
> > +
> > +	/*
> > +	 * Here we write the ro user page when
> > +	 * cr0.wp=0, then we execute it and SMEP
> > +	 * fault should happen.
> > +	 */
> > +	err_prepare_notwp = ac_test_do_access(&at1);
> > +	if (!err_prepare_notwp) {
> > +		printf("%s: SMEP prepare fail\n", __FUNCTION__);
> > +		goto clean_up;
> > +	}
> > +
> > +	at1.flags[AC_ACCESS_WRITE] = 0;
> > +	at1.flags[AC_ACCESS_FETCH] = 1;
> > +	ac_set_expected_status(&at1);
> > +	err_smep_notwp = ac_test_do_access(&at1);
> > +
> 
> The address is accessed in the fist test, it is really "prefetch"-ed
> in the second test?

What do you mean? Could you please elaborate it?

> 
> >
> >  int ac_test_run(void)
> > @@ -669,16 +765,22 @@ int ac_test_run(void)
> >      ac_test_t at;
> >      ac_pool_t pool;
> >      int i, tests, successes;
> > +    extern u64 ptl2[];
> >
> >      printf("run\n");
> >      tests = successes = 0;
> >      ac_env_int(&pool);
> >      ac_test_init(&at, (void *)(0x123400000000 + 16 * smp_id()));
> >      do {
> > +	if (at.flags[AC_CPU_CR4_SMEP] && (ptl2[2] & 0x4))
> > +		ptl2[2] -= 0x4;
> 
> It seems you just remove the "U/S" bit, but forget to recover it, it can
> break the test if AC_ACCESS_USER && !SMEP

Thanks. I'll correct it:)

> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
��.n��������+%������w��{.n�����o�^n�r������&��z�ޗ�zf���h���~����������_��+v���)ߣ�

[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