All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Tian, Kevin" <kevin.tian@intel.com>
To: Tamas K Lengyel <tamas.lengyel@zentific.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>
Cc: "ian.campbell@citrix.com" <ian.campbell@citrix.com>,
	"stefano.stabellini@eu.citrix.com"
	<stefano.stabellini@eu.citrix.com>,
	"Nakajima, Jun" <jun.nakajima@intel.com>,
	"Dong, Eddie" <eddie.dong@intel.com>,
	"ian.jackson@eu.citrix.com" <ian.jackson@eu.citrix.com>,
	"JBeulich@suse.com" <JBeulich@suse.com>,
	"Aravind.Gopalakrishnan@amd.com" <Aravind.Gopalakrishnan@amd.com>,
	"suravee.suthikulpanit@amd.com" <suravee.suthikulpanit@amd.com>,
	"boris.ostrovsky@oracle.com" <boris.ostrovsky@oracle.com>
Subject: Re: [PATCH v6 2/4] x86/hvm: Treat non-instruction fetch nested page faults also as read violations
Date: Thu, 14 Aug 2014 00:31:00 +0000	[thread overview]
Message-ID: <AADFC41AFE54684AB9EE6CBC0274A5D126036E11@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <1407768526-29112-2-git-send-email-tamas.lengyel@zentific.com>

> From: Tamas K Lengyel [mailto:tamas.lengyel@zentific.com]
> Sent: Monday, August 11, 2014 7:49 AM
> 
> As pointed out by Jan Beulich in
> http://lists.xen.org/archives/html/xen-devel/2014-08/msg01269.html:
> "Read-modify-write instructions absolutely need to be treated as read
> accesses, yet hardware doesn't guarantee to tell us so (they may surface as
> just write accesses)." This patch addresses the issue in both the VMX and the
> SVM side.
> 
> VMX: Treat all non-instruction fetch violations as read violations (in addition to
> those that were already reported as read violations).

so as a result all the write violations are also treated as read violations here? 
it's more than fixing the comment above...

> SVM: Refine the handling to distinguish between read/write and instruction
> fetch access violations.
> 
> Signed-off-by: Tamas K Lengyel <tamas.lengyel@zentific.com>
> ---
>  xen/arch/x86/hvm/svm/svm.c | 2 +-
>  xen/arch/x86/hvm/vmx/vmx.c | 3 ++-
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/arch/x86/hvm/svm/svm.c b/xen/arch/x86/hvm/svm/svm.c
> index 1f72e19..9531248 100644
> --- a/xen/arch/x86/hvm/svm/svm.c
> +++ b/xen/arch/x86/hvm/svm/svm.c
> @@ -1404,7 +1404,7 @@ static void svm_do_nested_pgfault(struct vcpu *v,
>      struct p2m_domain *p2m = NULL;
> 
>      struct npfec npfec = {
> -        .read_access = 1, /* All NPFs count as reads */
> +        .read_access = !(pfec & PFEC_insn_fetch),
>          .write_access = !!(pfec & PFEC_write_access),
>          .insn_fetch = !!(pfec & PFEC_insn_fetch)
>      };
> diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c
> index 656ce61..af0ad7c 100644
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -2354,7 +2354,8 @@ static void ept_handle_violation(unsigned long
> qualification, paddr_t gpa)
>      int ret;
>      struct domain *d = current->domain;
>      struct npfec npfec = {
> -        .read_access = !!(qualification & EPT_READ_VIOLATION),
> +        .read_access = !!(qualification & EPT_READ_VIOLATION) ||
> +                        !(qualification & EPT_EXEC_VIOLATION),
>          .write_access = !!(qualification & EPT_WRITE_VIOLATION),
>          .insn_fetch = !!(qualification & EPT_EXEC_VIOLATION)
>      };
> --
> 2.0.1

  parent reply	other threads:[~2014-08-14  0:31 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-11 14:48 [PATCH v6 1/4] x86: Consolidate boolean inputs in hvm and p2m into a shared bitmap Tamas K Lengyel
2014-08-11 14:48 ` [PATCH v6 2/4] x86/hvm: Treat non-instruction fetch nested page faults also as read violations Tamas K Lengyel
2014-08-11 16:04   ` Jan Beulich
2014-08-14  0:31   ` Tian, Kevin [this message]
2014-08-14  8:02     ` Tamas Lengyel
2014-08-14 16:43       ` Tian, Kevin
2014-08-14 16:49         ` Andrew Cooper
2014-08-14 17:32           ` Tamas Lengyel
2014-08-14 20:39           ` Jan Beulich
2014-08-14 22:34             ` Tian, Kevin
2014-08-14 22:59               ` Jan Beulich
2014-08-14 23:04                 ` Tian, Kevin
2014-08-14 23:08                   ` Jan Beulich
2014-08-14 23:20                     ` Tian, Kevin
2014-08-14 23:36                       ` Jan Beulich
2014-08-14 23:40                         ` Tian, Kevin
2014-08-15 14:57                           ` Jan Beulich
2014-08-15 20:17                             ` Tian, Kevin
2014-08-15 21:23                               ` Jan Beulich
2014-08-15 21:32                                 ` Tian, Kevin
2014-08-15 14:31                 ` Boris Ostrovsky
2014-08-15 15:01                   ` Jan Beulich
2014-08-15 15:09                     ` Boris Ostrovsky
2014-08-15 15:29                       ` Jan Beulich
2014-08-15 15:50                         ` Boris Ostrovsky
2014-08-15 16:33                           ` Tamas Lengyel
2014-08-15 16:48                             ` Jan Beulich
2014-08-18 19:37                               ` Tamas K Lengyel
2014-08-18 20:31                                 ` Jan Beulich
2014-08-11 14:48 ` [PATCH v6 3/4] x86/mem_event: Deliver gla fault EPT violation information Tamas K Lengyel
2014-08-11 16:08   ` Jan Beulich
2014-08-12 11:18     ` Tamas Lengyel
2014-08-12 12:10       ` Jan Beulich
2014-08-11 17:27   ` Boris Ostrovsky
2014-08-11 18:35     ` Tamas Lengyel
2014-08-11 14:48 ` [PATCH v6 4/4] tools/xen-access: Print gla valid/fault information Tamas K Lengyel
2014-08-12 15:31   ` Ian Jackson
2014-08-12 21:54     ` Tamas Lengyel
2014-08-11 16:03 ` [PATCH v6 1/4] x86: Consolidate boolean inputs in hvm and p2m into a shared bitmap Jan Beulich
2014-08-11 17:13 ` Boris Ostrovsky
2014-08-11 17:23   ` Tamas Lengyel
2014-08-14  0:18 ` Tian, Kevin
2014-08-28 12:36 ` Tim Deegan

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=AADFC41AFE54684AB9EE6CBC0274A5D126036E11@SHSMSX101.ccr.corp.intel.com \
    --to=kevin.tian@intel.com \
    --cc=Aravind.Gopalakrishnan@amd.com \
    --cc=JBeulich@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=eddie.dong@intel.com \
    --cc=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jun.nakajima@intel.com \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=tamas.lengyel@zentific.com \
    --cc=xen-devel@lists.xen.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.