xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] x86/mce: handle reserved domain ID in XEN_MC_msrinject
@ 2016-05-27 13:30 Haozhong Zhang
  2016-05-27 14:03 ` Jan Beulich
  2016-06-06 13:40 ` Egger, Christoph
  0 siblings, 2 replies; 11+ messages in thread
From: Haozhong Zhang @ 2016-05-27 13:30 UTC (permalink / raw)
  To: xen-devel
  Cc: Haozhong Zhang, Wei Liu, pengtaox.zhang, Liu Jinsong,
	Christoph Egger, xudong.hao, Jan Beulich, Andrew Cooper

Commit 26646f3 "x86/mce: translate passed-in GPA to host machine
address" and commit 4ddf474 "tools/xen-mceinj: Pass in GPA when
injecting through MSR_MCI_ADDR" forgot to consider reserved domain
ID and mistakenly add MC_MSRINJ_F_GPADDR flag for them, which in turn
causes bug reported by
http://lists.xenproject.org/archives/html/xen-devel/2016-05/msg02640.html.

This patch removes MC_MSRINK_F_GPADDR flag and checks this when injecting
to reserved domain IDs except DOMID_SELF, and treats the passed-in
address as host machine address.

Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
---
Changes in v3:
 * Refine check condition of domid.

Changes in v2:
 * Consider all reserved domain IDs rather than just DOMID_XEN.

v1 can be found at
http://lists.xenproject.org/archives/html/xen-devel/2016-05/msg02534.html.
---
 tools/tests/mce-test/tools/xen-mceinj.c |  5 ++++-
 xen/arch/x86/cpu/mcheck/mce.c           | 14 +++++++++++---
 2 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/tools/tests/mce-test/tools/xen-mceinj.c b/tools/tests/mce-test/tools/xen-mceinj.c
index 061ec7c..51abc8a 100644
--- a/tools/tests/mce-test/tools/xen-mceinj.c
+++ b/tools/tests/mce-test/tools/xen-mceinj.c
@@ -317,7 +317,10 @@ static int inject_mci_addr(xc_interface *xc_handle,
                            domid_t domid)
 {
     return add_msr_bank_intpose(xc_handle, cpu_nr,
-                                MC_MSRINJ_F_INTERPOSE | MC_MSRINJ_F_GPADDR,
+                                MC_MSRINJ_F_INTERPOSE |
+                                ((domid >= DOMID_FIRST_RESERVED &&
+                                  domid != DOMID_SELF) ?
+                                 0 : MC_MSRINJ_F_GPADDR),
                                 MCi_type_ADDR, bank, val, domid);
 }
 
diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
index cc446eb..0244553 100644
--- a/xen/arch/x86/cpu/mcheck/mce.c
+++ b/xen/arch/x86/cpu/mcheck/mce.c
@@ -1427,6 +1427,7 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc)
 
         if ( mc_msrinject->mcinj_flags & MC_MSRINJ_F_GPADDR )
         {
+            domid_t domid;
             struct domain *d;
             struct mcinfo_msr *msr;
             unsigned int i;
@@ -1434,10 +1435,17 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc)
             unsigned long gfn, mfn;
             p2m_type_t t;
 
-            d = get_domain_by_id(mc_msrinject->mcinj_domid);
+            domid = (mc_msrinject->mcinj_domid == DOMID_SELF) ?
+                    current->domain->domain_id : mc_msrinject->mcinj_domid;
+            if ( domid >= DOMID_FIRST_RESERVED )
+                return x86_mcerr("do_mca inject: incompatible flag "
+                                 "MC_MSRINJ_F_GPADDR with domain %d",
+                                 -EINVAL, domid);
+
+            d = get_domain_by_id(domid);
             if ( d == NULL )
                 return x86_mcerr("do_mca inject: bad domain id %d",
-                                 -EINVAL, mc_msrinject->mcinj_domid);
+                                 -EINVAL, domid);
 
             for ( i = 0, msr = &mc_msrinject->mcinj_msr[0];
                   i < mc_msrinject->mcinj_count;
@@ -1452,7 +1460,7 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc)
                     put_gfn(d, gfn);
                     put_domain(d);
                     return x86_mcerr("do_mca inject: bad gfn %#lx of domain %d",
-                                     -EINVAL, gfn, mc_msrinject->mcinj_domid);
+                                     -EINVAL, gfn, domid);
                 }
 
                 msr->value = pfn_to_paddr(mfn) | (gaddr & (PAGE_SIZE - 1));
-- 
2.8.3


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v3] x86/mce: handle reserved domain ID in XEN_MC_msrinject
  2016-05-27 13:30 [PATCH v3] x86/mce: handle reserved domain ID in XEN_MC_msrinject Haozhong Zhang
@ 2016-05-27 14:03 ` Jan Beulich
  2016-05-27 14:06   ` Wei Liu
  2016-06-06 13:40 ` Egger, Christoph
  1 sibling, 1 reply; 11+ messages in thread
From: Jan Beulich @ 2016-05-27 14:03 UTC (permalink / raw)
  To: Haozhong Zhang
  Cc: Wei Liu, pengtaox.zhang, Liu Jinsong, Christoph Egger,
	xudong.hao, xen-devel, Andrew Cooper

>>> On 27.05.16 at 15:30, <haozhong.zhang@intel.com> wrote:
> Commit 26646f3 "x86/mce: translate passed-in GPA to host machine
> address" and commit 4ddf474 "tools/xen-mceinj: Pass in GPA when
> injecting through MSR_MCI_ADDR" forgot to consider reserved domain
> ID and mistakenly add MC_MSRINJ_F_GPADDR flag for them, which in turn
> causes bug reported by
> http://lists.xenproject.org/archives/html/xen-devel/2016-05/msg02640.html.
> 
> This patch removes MC_MSRINK_F_GPADDR flag and checks this when injecting
> to reserved domain IDs except DOMID_SELF, and treats the passed-in
> address as host machine address.
> 
> Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3] x86/mce: handle reserved domain ID in XEN_MC_msrinject
  2016-05-27 14:03 ` Jan Beulich
@ 2016-05-27 14:06   ` Wei Liu
  2016-05-27 15:31     ` Wei Liu
  0 siblings, 1 reply; 11+ messages in thread
From: Wei Liu @ 2016-05-27 14:06 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Haozhong Zhang, Wei Liu, pengtaox.zhang, Andrew Cooper,
	Christoph Egger, xudong.hao, xen-devel, Liu Jinsong

On Fri, May 27, 2016 at 08:03:42AM -0600, Jan Beulich wrote:
> >>> On 27.05.16 at 15:30, <haozhong.zhang@intel.com> wrote:
> > Commit 26646f3 "x86/mce: translate passed-in GPA to host machine
> > address" and commit 4ddf474 "tools/xen-mceinj: Pass in GPA when
> > injecting through MSR_MCI_ADDR" forgot to consider reserved domain
> > ID and mistakenly add MC_MSRINJ_F_GPADDR flag for them, which in turn
> > causes bug reported by
> > http://lists.xenproject.org/archives/html/xen-devel/2016-05/msg02640.html.
> > 
> > This patch removes MC_MSRINK_F_GPADDR flag and checks this when injecting
> > to reserved domain IDs except DOMID_SELF, and treats the passed-in
> > address as host machine address.
> > 
> > Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
> 
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
> 

Release-acked-by: Wei Liu <wei.liu2@citrix.com>

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3] x86/mce: handle reserved domain ID in XEN_MC_msrinject
  2016-05-27 14:06   ` Wei Liu
@ 2016-05-27 15:31     ` Wei Liu
  2016-05-27 16:06       ` Jan Beulich
  0 siblings, 1 reply; 11+ messages in thread
From: Wei Liu @ 2016-05-27 15:31 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Haozhong Zhang, Wei Liu, pengtaox.zhang, Andrew Cooper,
	Christoph Egger, xudong.hao, xen-devel, Liu Jinsong

On Fri, May 27, 2016 at 03:06:08PM +0100, Wei Liu wrote:
> On Fri, May 27, 2016 at 08:03:42AM -0600, Jan Beulich wrote:
> > >>> On 27.05.16 at 15:30, <haozhong.zhang@intel.com> wrote:
> > > Commit 26646f3 "x86/mce: translate passed-in GPA to host machine
> > > address" and commit 4ddf474 "tools/xen-mceinj: Pass in GPA when
> > > injecting through MSR_MCI_ADDR" forgot to consider reserved domain
> > > ID and mistakenly add MC_MSRINJ_F_GPADDR flag for them, which in turn
> > > causes bug reported by
> > > http://lists.xenproject.org/archives/html/xen-devel/2016-05/msg02640.html.
> > > 
> > > This patch removes MC_MSRINK_F_GPADDR flag and checks this when injecting
> > > to reserved domain IDs except DOMID_SELF, and treats the passed-in
> > > address as host machine address.
> > > 
> > > Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
> > 
> > Reviewed-by: Jan Beulich <jbeulich@suse.com>
> > 
> 
> Release-acked-by: Wei Liu <wei.liu2@citrix.com>

And queued.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3] x86/mce: handle reserved domain ID in XEN_MC_msrinject
  2016-05-27 15:31     ` Wei Liu
@ 2016-05-27 16:06       ` Jan Beulich
  2016-05-27 16:14         ` Wei Liu
  0 siblings, 1 reply; 11+ messages in thread
From: Jan Beulich @ 2016-05-27 16:06 UTC (permalink / raw)
  To: Wei Liu
  Cc: Haozhong Zhang, pengtaox.zhang, Liu Jinsong, Christoph Egger,
	xudong.hao, xen-devel, AndrewCooper

>>> On 27.05.16 at 17:31, <wei.liu2@citrix.com> wrote:
> On Fri, May 27, 2016 at 03:06:08PM +0100, Wei Liu wrote:
>> On Fri, May 27, 2016 at 08:03:42AM -0600, Jan Beulich wrote:
>> > >>> On 27.05.16 at 15:30, <haozhong.zhang@intel.com> wrote:
>> > > Commit 26646f3 "x86/mce: translate passed-in GPA to host machine
>> > > address" and commit 4ddf474 "tools/xen-mceinj: Pass in GPA when
>> > > injecting through MSR_MCI_ADDR" forgot to consider reserved domain
>> > > ID and mistakenly add MC_MSRINJ_F_GPADDR flag for them, which in turn
>> > > causes bug reported by
>> > > http://lists.xenproject.org/archives/html/xen-devel/2016-05/msg02640.html.
>> > > 
>> > > This patch removes MC_MSRINK_F_GPADDR flag and checks this when injecting
>> > > to reserved domain IDs except DOMID_SELF, and treats the passed-in
>> > > address as host machine address.
>> > > 
>> > > Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
>> > 
>> > Reviewed-by: Jan Beulich <jbeulich@suse.com>
>> > 
>> 
>> Release-acked-by: Wei Liu <wei.liu2@citrix.com>
> 
> And queued.

Please wait for a maintainer ack.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3] x86/mce: handle reserved domain ID in XEN_MC_msrinject
  2016-05-27 16:06       ` Jan Beulich
@ 2016-05-27 16:14         ` Wei Liu
  2016-05-27 16:16           ` Wei Liu
  0 siblings, 1 reply; 11+ messages in thread
From: Wei Liu @ 2016-05-27 16:14 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Haozhong Zhang, Wei Liu, pengtaox.zhang, Liu Jinsong,
	Christoph Egger, xudong.hao, xen-devel, AndrewCooper

On Fri, May 27, 2016 at 10:06:31AM -0600, Jan Beulich wrote:
> >>> On 27.05.16 at 17:31, <wei.liu2@citrix.com> wrote:
> > On Fri, May 27, 2016 at 03:06:08PM +0100, Wei Liu wrote:
> >> On Fri, May 27, 2016 at 08:03:42AM -0600, Jan Beulich wrote:
> >> > >>> On 27.05.16 at 15:30, <haozhong.zhang@intel.com> wrote:
> >> > > Commit 26646f3 "x86/mce: translate passed-in GPA to host machine
> >> > > address" and commit 4ddf474 "tools/xen-mceinj: Pass in GPA when
> >> > > injecting through MSR_MCI_ADDR" forgot to consider reserved domain
> >> > > ID and mistakenly add MC_MSRINJ_F_GPADDR flag for them, which in turn
> >> > > causes bug reported by
> >> > > http://lists.xenproject.org/archives/html/xen-devel/2016-05/msg02640.html.
> >> > > 
> >> > > This patch removes MC_MSRINK_F_GPADDR flag and checks this when injecting
> >> > > to reserved domain IDs except DOMID_SELF, and treats the passed-in
> >> > > address as host machine address.
> >> > > 
> >> > > Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
> >> > 
> >> > Reviewed-by: Jan Beulich <jbeulich@suse.com>
> >> > 
> >> 
> >> Release-acked-by: Wei Liu <wei.liu2@citrix.com>
> > 
> > And queued.
> 
> Please wait for a maintainer ack.
> 

$ ./scripts/get_maintainer.pl -f xen/arch/x86/cpu/mcheck/mce.c
Christoph Egger <chegger@amazon.de>
Liu Jinsong <jinsong.liu@alibaba-inc.com>
Jan Beulich <jbeulich@suse.com>
Andrew Cooper <andrew.cooper3@citrix.com>
xen-devel@lists.xen.org

So I took it that your review was sufficient and pushed it.

It's already in staging. I can revert it now.

Wei.

> Jan
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3] x86/mce: handle reserved domain ID in XEN_MC_msrinject
  2016-05-27 16:14         ` Wei Liu
@ 2016-05-27 16:16           ` Wei Liu
  2016-06-01  6:38             ` Haozhong Zhang
  0 siblings, 1 reply; 11+ messages in thread
From: Wei Liu @ 2016-05-27 16:16 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Haozhong Zhang, Wei Liu, pengtaox.zhang, Liu Jinsong,
	Christoph Egger, xudong.hao, xen-devel, AndrewCooper

On Fri, May 27, 2016 at 05:14:08PM +0100, Wei Liu wrote:
> On Fri, May 27, 2016 at 10:06:31AM -0600, Jan Beulich wrote:
> > >>> On 27.05.16 at 17:31, <wei.liu2@citrix.com> wrote:
> > > On Fri, May 27, 2016 at 03:06:08PM +0100, Wei Liu wrote:
> > >> On Fri, May 27, 2016 at 08:03:42AM -0600, Jan Beulich wrote:
> > >> > >>> On 27.05.16 at 15:30, <haozhong.zhang@intel.com> wrote:
> > >> > > Commit 26646f3 "x86/mce: translate passed-in GPA to host machine
> > >> > > address" and commit 4ddf474 "tools/xen-mceinj: Pass in GPA when
> > >> > > injecting through MSR_MCI_ADDR" forgot to consider reserved domain
> > >> > > ID and mistakenly add MC_MSRINJ_F_GPADDR flag for them, which in turn
> > >> > > causes bug reported by
> > >> > > http://lists.xenproject.org/archives/html/xen-devel/2016-05/msg02640.html.
> > >> > > 
> > >> > > This patch removes MC_MSRINK_F_GPADDR flag and checks this when injecting
> > >> > > to reserved domain IDs except DOMID_SELF, and treats the passed-in
> > >> > > address as host machine address.
> > >> > > 
> > >> > > Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
> > >> > 
> > >> > Reviewed-by: Jan Beulich <jbeulich@suse.com>
> > >> > 
> > >> 
> > >> Release-acked-by: Wei Liu <wei.liu2@citrix.com>
> > > 
> > > And queued.
> > 
> > Please wait for a maintainer ack.
> > 
> 
> $ ./scripts/get_maintainer.pl -f xen/arch/x86/cpu/mcheck/mce.c
> Christoph Egger <chegger@amazon.de>
> Liu Jinsong <jinsong.liu@alibaba-inc.com>
> Jan Beulich <jbeulich@suse.com>
> Andrew Cooper <andrew.cooper3@citrix.com>
> xen-devel@lists.xen.org
> 

OK, so looking at MAINTAINERS file:

MACHINE CHECK (MCA) & RAS
M:      Christoph Egger <chegger@amazon.de>
M:      Liu Jinsong <jinsong.liu@alibaba-inc.com>
S:      Supported
F:      xen/arch/x86/cpu/mcheck/

I will revert this patch now. Sorry for all the trouble!

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3] x86/mce: handle reserved domain ID in XEN_MC_msrinject
  2016-05-27 16:16           ` Wei Liu
@ 2016-06-01  6:38             ` Haozhong Zhang
  2016-06-06 13:08               ` Wei Liu
  0 siblings, 1 reply; 11+ messages in thread
From: Haozhong Zhang @ 2016-06-01  6:38 UTC (permalink / raw)
  To: Christoph Egger, Liu Jinsong
  Cc: Wei Liu, pengtaox.zhang, AndrewCooper, xudong.hao, xen-devel,
	Jan Beulich

On 05/27/16 17:16, Wei Liu wrote:
> On Fri, May 27, 2016 at 05:14:08PM +0100, Wei Liu wrote:
> > On Fri, May 27, 2016 at 10:06:31AM -0600, Jan Beulich wrote:
> > > >>> On 27.05.16 at 17:31, <wei.liu2@citrix.com> wrote:
> > > > On Fri, May 27, 2016 at 03:06:08PM +0100, Wei Liu wrote:
> > > >> On Fri, May 27, 2016 at 08:03:42AM -0600, Jan Beulich wrote:
> > > >> > >>> On 27.05.16 at 15:30, <haozhong.zhang@intel.com> wrote:
> > > >> > > Commit 26646f3 "x86/mce: translate passed-in GPA to host machine
> > > >> > > address" and commit 4ddf474 "tools/xen-mceinj: Pass in GPA when
> > > >> > > injecting through MSR_MCI_ADDR" forgot to consider reserved domain
> > > >> > > ID and mistakenly add MC_MSRINJ_F_GPADDR flag for them, which in turn
> > > >> > > causes bug reported by
> > > >> > > http://lists.xenproject.org/archives/html/xen-devel/2016-05/msg02640.html.
> > > >> > > 
> > > >> > > This patch removes MC_MSRINK_F_GPADDR flag and checks this when injecting
> > > >> > > to reserved domain IDs except DOMID_SELF, and treats the passed-in
> > > >> > > address as host machine address.
> > > >> > > 
> > > >> > > Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
> > > >> > 
> > > >> > Reviewed-by: Jan Beulich <jbeulich@suse.com>
> > > >> > 
> > > >> 
> > > >> Release-acked-by: Wei Liu <wei.liu2@citrix.com>
> > > > 
> > > > And queued.
> > > 
> > > Please wait for a maintainer ack.
> > > 
> > 
> > $ ./scripts/get_maintainer.pl -f xen/arch/x86/cpu/mcheck/mce.c
> > Christoph Egger <chegger@amazon.de>
> > Liu Jinsong <jinsong.liu@alibaba-inc.com>
> > Jan Beulich <jbeulich@suse.com>
> > Andrew Cooper <andrew.cooper3@citrix.com>
> > xen-devel@lists.xen.org
> > 
> 
> OK, so looking at MAINTAINERS file:
> 
> MACHINE CHECK (MCA) & RAS
> M:      Christoph Egger <chegger@amazon.de>
> M:      Liu Jinsong <jinsong.liu@alibaba-inc.com>
> S:      Supported
> F:      xen/arch/x86/cpu/mcheck/
> 
> I will revert this patch now. Sorry for all the trouble!
> 
> Wei.

Hi Christoph and Jinsong,

Could you help to look at this patch set?

Thanks,
Haozhong

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3] x86/mce: handle reserved domain ID in XEN_MC_msrinject
  2016-06-01  6:38             ` Haozhong Zhang
@ 2016-06-06 13:08               ` Wei Liu
  0 siblings, 0 replies; 11+ messages in thread
From: Wei Liu @ 2016-06-06 13:08 UTC (permalink / raw)
  To: Christoph Egger, Liu Jinsong, Wei Liu, Jan Beulich,
	pengtaox.zhang, xudong.hao, xen-devel, AndrewCooper

On Wed, Jun 01, 2016 at 02:38:17PM +0800, Haozhong Zhang wrote:
> On 05/27/16 17:16, Wei Liu wrote:
> > On Fri, May 27, 2016 at 05:14:08PM +0100, Wei Liu wrote:
> > > On Fri, May 27, 2016 at 10:06:31AM -0600, Jan Beulich wrote:
> > > > >>> On 27.05.16 at 17:31, <wei.liu2@citrix.com> wrote:
> > > > > On Fri, May 27, 2016 at 03:06:08PM +0100, Wei Liu wrote:
> > > > >> On Fri, May 27, 2016 at 08:03:42AM -0600, Jan Beulich wrote:
> > > > >> > >>> On 27.05.16 at 15:30, <haozhong.zhang@intel.com> wrote:
> > > > >> > > Commit 26646f3 "x86/mce: translate passed-in GPA to host machine
> > > > >> > > address" and commit 4ddf474 "tools/xen-mceinj: Pass in GPA when
> > > > >> > > injecting through MSR_MCI_ADDR" forgot to consider reserved domain
> > > > >> > > ID and mistakenly add MC_MSRINJ_F_GPADDR flag for them, which in turn
> > > > >> > > causes bug reported by
> > > > >> > > http://lists.xenproject.org/archives/html/xen-devel/2016-05/msg02640.html.
> > > > >> > > 
> > > > >> > > This patch removes MC_MSRINK_F_GPADDR flag and checks this when injecting
> > > > >> > > to reserved domain IDs except DOMID_SELF, and treats the passed-in
> > > > >> > > address as host machine address.
> > > > >> > > 
> > > > >> > > Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
> > > > >> > 
> > > > >> > Reviewed-by: Jan Beulich <jbeulich@suse.com>
> > > > >> > 
> > > > >> 
> > > > >> Release-acked-by: Wei Liu <wei.liu2@citrix.com>
> > > > > 
> > > > > And queued.
> > > > 
> > > > Please wait for a maintainer ack.
> > > > 
> > > 
> > > $ ./scripts/get_maintainer.pl -f xen/arch/x86/cpu/mcheck/mce.c
> > > Christoph Egger <chegger@amazon.de>
> > > Liu Jinsong <jinsong.liu@alibaba-inc.com>
> > > Jan Beulich <jbeulich@suse.com>
> > > Andrew Cooper <andrew.cooper3@citrix.com>
> > > xen-devel@lists.xen.org
> > > 
> > 
> > OK, so looking at MAINTAINERS file:
> > 
> > MACHINE CHECK (MCA) & RAS
> > M:      Christoph Egger <chegger@amazon.de>
> > M:      Liu Jinsong <jinsong.liu@alibaba-inc.com>
> > S:      Supported
> > F:      xen/arch/x86/cpu/mcheck/
> > 
> > I will revert this patch now. Sorry for all the trouble!
> > 
> > Wei.
> 
> Hi Christoph and Jinsong,
> 
> Could you help to look at this patch set?
> 

I think this is a bit too late for 4.7.0.

It can be backported when Christoph and Jinsong get around to it.

Wei.

> Thanks,
> Haozhong

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3] x86/mce: handle reserved domain ID in XEN_MC_msrinject
  2016-05-27 13:30 [PATCH v3] x86/mce: handle reserved domain ID in XEN_MC_msrinject Haozhong Zhang
  2016-05-27 14:03 ` Jan Beulich
@ 2016-06-06 13:40 ` Egger, Christoph
  2016-06-06 13:47   ` Wei Liu
  1 sibling, 1 reply; 11+ messages in thread
From: Egger, Christoph @ 2016-06-06 13:40 UTC (permalink / raw)
  To: Haozhong Zhang, xen-devel
  Cc: Wei Liu, pengtaox.zhang, Liu Jinsong, xudong.hao, Jan Beulich,
	Andrew Cooper

On 27.05.16 15:30, Haozhong Zhang wrote:
> Commit 26646f3 "x86/mce: translate passed-in GPA to host machine
> address" and commit 4ddf474 "tools/xen-mceinj: Pass in GPA when
> injecting through MSR_MCI_ADDR" forgot to consider reserved domain
> ID and mistakenly add MC_MSRINJ_F_GPADDR flag for them, which in turn
> causes bug reported by
> http://lists.xenproject.org/archives/html/xen-devel/2016-05/msg02640.html.
> 
> This patch removes MC_MSRINK_F_GPADDR flag and checks this when injecting
> to reserved domain IDs except DOMID_SELF, and treats the passed-in
> address as host machine address.
> 
> Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>

Acked-by: Christoph Egger <chegger@amazon.de>

> ---
> Changes in v3:
>  * Refine check condition of domid.
> 
> Changes in v2:
>  * Consider all reserved domain IDs rather than just DOMID_XEN.
> 
> v1 can be found at
> http://lists.xenproject.org/archives/html/xen-devel/2016-05/msg02534.html.
> ---
>  tools/tests/mce-test/tools/xen-mceinj.c |  5 ++++-
>  xen/arch/x86/cpu/mcheck/mce.c           | 14 +++++++++++---
>  2 files changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/tests/mce-test/tools/xen-mceinj.c b/tools/tests/mce-test/tools/xen-mceinj.c
> index 061ec7c..51abc8a 100644
> --- a/tools/tests/mce-test/tools/xen-mceinj.c
> +++ b/tools/tests/mce-test/tools/xen-mceinj.c
> @@ -317,7 +317,10 @@ static int inject_mci_addr(xc_interface *xc_handle,
>                             domid_t domid)
>  {
>      return add_msr_bank_intpose(xc_handle, cpu_nr,
> -                                MC_MSRINJ_F_INTERPOSE | MC_MSRINJ_F_GPADDR,
> +                                MC_MSRINJ_F_INTERPOSE |
> +                                ((domid >= DOMID_FIRST_RESERVED &&
> +                                  domid != DOMID_SELF) ?
> +                                 0 : MC_MSRINJ_F_GPADDR),
>                                  MCi_type_ADDR, bank, val, domid);
>  }
>  
> diff --git a/xen/arch/x86/cpu/mcheck/mce.c b/xen/arch/x86/cpu/mcheck/mce.c
> index cc446eb..0244553 100644
> --- a/xen/arch/x86/cpu/mcheck/mce.c
> +++ b/xen/arch/x86/cpu/mcheck/mce.c
> @@ -1427,6 +1427,7 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc)
>  
>          if ( mc_msrinject->mcinj_flags & MC_MSRINJ_F_GPADDR )
>          {
> +            domid_t domid;
>              struct domain *d;
>              struct mcinfo_msr *msr;
>              unsigned int i;
> @@ -1434,10 +1435,17 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc)
>              unsigned long gfn, mfn;
>              p2m_type_t t;
>  
> -            d = get_domain_by_id(mc_msrinject->mcinj_domid);
> +            domid = (mc_msrinject->mcinj_domid == DOMID_SELF) ?
> +                    current->domain->domain_id : mc_msrinject->mcinj_domid;
> +            if ( domid >= DOMID_FIRST_RESERVED )
> +                return x86_mcerr("do_mca inject: incompatible flag "
> +                                 "MC_MSRINJ_F_GPADDR with domain %d",
> +                                 -EINVAL, domid);
> +
> +            d = get_domain_by_id(domid);
>              if ( d == NULL )
>                  return x86_mcerr("do_mca inject: bad domain id %d",
> -                                 -EINVAL, mc_msrinject->mcinj_domid);
> +                                 -EINVAL, domid);
>  
>              for ( i = 0, msr = &mc_msrinject->mcinj_msr[0];
>                    i < mc_msrinject->mcinj_count;
> @@ -1452,7 +1460,7 @@ long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc)
>                      put_gfn(d, gfn);
>                      put_domain(d);
>                      return x86_mcerr("do_mca inject: bad gfn %#lx of domain %d",
> -                                     -EINVAL, gfn, mc_msrinject->mcinj_domid);
> +                                     -EINVAL, gfn, domid);
>                  }
>  
>                  msr->value = pfn_to_paddr(mfn) | (gaddr & (PAGE_SIZE - 1));
> 


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v3] x86/mce: handle reserved domain ID in XEN_MC_msrinject
  2016-06-06 13:40 ` Egger, Christoph
@ 2016-06-06 13:47   ` Wei Liu
  0 siblings, 0 replies; 11+ messages in thread
From: Wei Liu @ 2016-06-06 13:47 UTC (permalink / raw)
  To: Egger, Christoph
  Cc: Haozhong Zhang, Wei Liu, pengtaox.zhang, Liu Jinsong, xudong.hao,
	xen-devel, Jan Beulich, Andrew Cooper

On Mon, Jun 06, 2016 at 03:40:33PM +0200, Egger, Christoph wrote:
> On 27.05.16 15:30, Haozhong Zhang wrote:
> > Commit 26646f3 "x86/mce: translate passed-in GPA to host machine
> > address" and commit 4ddf474 "tools/xen-mceinj: Pass in GPA when
> > injecting through MSR_MCI_ADDR" forgot to consider reserved domain
> > ID and mistakenly add MC_MSRINJ_F_GPADDR flag for them, which in turn
> > causes bug reported by
> > http://lists.xenproject.org/archives/html/xen-devel/2016-05/msg02640.html.
> > 
> > This patch removes MC_MSRINK_F_GPADDR flag and checks this when injecting
> > to reserved domain IDs except DOMID_SELF, and treats the passed-in
> > address as host machine address.
> > 
> > Signed-off-by: Haozhong Zhang <haozhong.zhang@intel.com>
> 
> Acked-by: Christoph Egger <chegger@amazon.de>
> 

Thanks! I will see what I can with it for 4.7.0.

Wei.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-06-06 13:47 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-27 13:30 [PATCH v3] x86/mce: handle reserved domain ID in XEN_MC_msrinject Haozhong Zhang
2016-05-27 14:03 ` Jan Beulich
2016-05-27 14:06   ` Wei Liu
2016-05-27 15:31     ` Wei Liu
2016-05-27 16:06       ` Jan Beulich
2016-05-27 16:14         ` Wei Liu
2016-05-27 16:16           ` Wei Liu
2016-06-01  6:38             ` Haozhong Zhang
2016-06-06 13:08               ` Wei Liu
2016-06-06 13:40 ` Egger, Christoph
2016-06-06 13:47   ` Wei Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).