public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
To: "Yang, Wei" <wei.y.yang@intel.com>
Cc: avi@redhat.com, kvm@vger.kernel.org
Subject: Re: [PATCH kvm-unit-tests v2] access: check SMEP on prefetch pte path
Date: Fri, 01 Jul 2011 16:05:39 +0800	[thread overview]
Message-ID: <4E0D7FD3.8030206@cn.fujitsu.com> (raw)
In-Reply-To: <1309343079-4895-1-git-send-email-wei.y.yang@intel.com>

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?

>  
>  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


  reply	other threads:[~2011-07-01  8:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-29 10:24 [PATCH kvm-unit-tests v2] access: check SMEP on prefetch pte path Yang, Wei
2011-07-01  8:05 ` Xiao Guangrong [this message]
2011-07-05  1:24   ` Yang, Wei Y
2011-07-05  5:49     ` Xiao Guangrong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E0D7FD3.8030206@cn.fujitsu.com \
    --to=xiaoguangrong@cn.fujitsu.com \
    --cc=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=wei.y.yang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox