x86/mce: handle reserved domain ID in XEN_MC_msrinject
PATCH v3 1/1 x86/mce: handle reserved domain ID in XEN_MC_msrinject
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.
---
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(-)
tools/tests/mce-test/tools/xen-mceinj.c +4 -1
@@ -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); }
xen/arch/x86/cpu/mcheck/mce.c +11 -3
@@ -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 ));
Signature · 7 lines
2.8.3 _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 27.05.16 at 15:30, <[email protected]> wrote:
Commit 26646f3 "x86/mce: translate passed-in GPA to host machine address" and commit 4ddf474 "
tools/xen-mceinj: Pass in GPA when injecting throughMSR_MCI_ADDR" forgot to consider reserved domain ID and mistakenly addMC_MSRINJ_F_GPADDRflag for them, which in turn causes bug reported by
http://lists.xenproject.org/archives/html/xen-devel/2016-05/msg02640.html.
Quoted 5 lines
This patch removes
MC_MSRINK_F_GPADDRflag and checks this when injecting to reserved domain IDs exceptDOMID_SELF, and treats the passed-in address as host machine address.Signed-off-by Haozhong Zhang <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 8 lines · Jan Beulich
Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 27.05.16 at 15:30, <[email protected]> wrote:
Commit 26646f3 "x86/mce: translate passed-in GPA to host machine address" and commit 4ddf474 "
tools/xen-mceinj: Pass in GPA when injecting throughMSR_MCI_ADDR" forgot to consider reserved domain ID and mistakenly addMC_MSRINJ_F_GPADDRflag for them, which in turn causes bug reported by
http://lists.xenproject.org/archives/html/xen-devel/2016-05/msg02640.html.
Quoted 8 lines
Quoted 5 lines
This patch removes
MC_MSRINK_F_GPADDRflag and checks this when injecting to reserved domain IDs exceptDOMID_SELF, and treats the passed-in address as host machine address.Signed-off-by Haozhong Zhang <[email protected]>Reviewed-by Jan Beulich <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 13 lines · Wei Liu
Quoted 12 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 27.05.16 at 15:30, <[email protected]> wrote:
Commit 26646f3 "x86/mce: translate passed-in GPA to host machine address" and commit 4ddf474 "
tools/xen-mceinj: Pass in GPA when injecting throughMSR_MCI_ADDR" forgot to consider reserved domain ID and mistakenly addMC_MSRINJ_F_GPADDRflag 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_GPADDRflag and checks this when injecting to reserved domain IDs exceptDOMID_SELF, and treats the passed-in address as host machine address.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Haozhong Zhang <[email protected]>Reviewed-by Jan Beulich <[email protected]>Release-acked-by Wei Liu <[email protected]>
And queued.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 15 lines
Quoted 1 line
Quoted 1 line · On 27.05.16 at 17:31, <[email protected]> wrote:
Quoted 13 lines · Wei Liu
Quoted 12 lines · Jan Beulich
Quoted 12 lines
Quoted 1 line
Quoted 1 line · On 27.05.16 at 15:30, <[email protected]> wrote:
Commit 26646f3 "x86/mce: translate passed-in GPA to host machine address" and commit 4ddf474 "
tools/xen-mceinj: Pass in GPA when injecting throughMSR_MCI_ADDR" forgot to consider reserved domain ID and mistakenly addMC_MSRINJ_F_GPADDRflag 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_GPADDRflag and checks this when injecting to reserved domain IDs exceptDOMID_SELF, and treats the passed-in address as host machine address.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
Signed-off-by Haozhong Zhang <[email protected]>Reviewed-by Jan Beulich <[email protected]>Release-acked-by Wei Liu <[email protected]>And queued.
Please wait for a maintainer ack.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 17 lines · Jan Beulich
Quoted 17 lines
Quoted 1 line
Quoted 1 line · On 27.05.16 at 17:31, <[email protected]> wrote:
Quoted 15 lines · Wei Liu
Quoted 14 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 27.05.16 at 15:30, <[email protected]> wrote:
Commit 26646f3 "x86/mce: translate passed-in GPA to host machine address" and commit 4ddf474 "
tools/xen-mceinj: Pass in GPA when injecting throughMSR_MCI_ADDR" forgot to consider reserved domain ID and mistakenly addMC_MSRINJ_F_GPADDRflag 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_GPADDRflag and checks this when injecting to reserved domain IDs exceptDOMID_SELF, and treats the passed-in address as host machine address.Signed-off-by Haozhong Zhang <[email protected]>
Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Reviewed-by Jan Beulich <[email protected]>Release-acked-by Wei Liu <[email protected]>And queued.
Please wait for a maintainer ack.
$ ./scripts/get_maintainer.pl -f xen/arch/x86/cpu/mcheck/mce.c Christoph Egger <[email protected]> Liu Jinsong <[email protected]> Jan Beulich <[email protected]> Andrew Cooper <[email protected]> [email protected]
So I took it that your review was sufficient and pushed it.
It's already in staging. I can revert it now.
Wei.
Quoted 7 lines
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 28 lines · Wei Liu
Quoted 17 lines · Jan Beulich
Quoted 17 lines
Quoted 1 line
Quoted 1 line · On 27.05.16 at 17:31, <[email protected]> wrote:
Quoted 15 lines · Wei Liu
Quoted 14 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 27.05.16 at 15:30, <[email protected]> wrote:
Commit 26646f3 "x86/mce: translate passed-in GPA to host machine address" and commit 4ddf474 "
tools/xen-mceinj: Pass in GPA when injecting throughMSR_MCI_ADDR" forgot to consider reserved domain ID and mistakenly addMC_MSRINJ_F_GPADDRflag 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_GPADDRflag and checks this when injecting to reserved domain IDs exceptDOMID_SELF, and treats the passed-in address as host machine address.Signed-off-by Haozhong Zhang <[email protected]>Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Reviewed-by Jan Beulich <[email protected]>Release-acked-by Wei Liu <[email protected]>And queued.
Please wait for a maintainer ack.
Quoted 7 lines
$ ./scripts/get_maintainer.pl -f xen/arch/x86/cpu/mcheck/mce.c Christoph Egger <[email protected]> Liu Jinsong <[email protected]> Jan Beulich <[email protected]> Andrew Cooper <[email protected]> [email protected]
OK, so looking at MAINTAINERS file:
MACHINE CHECK (MCA) & RAS
M: Christoph Egger <[email protected]> M: Liu Jinsong <[email protected]> S: Supported F: xen/arch/x86/cpu/mcheck/
I will revert this patch now. Sorry for all the trouble!
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 40 lines · Wei Liu
Quoted 28 lines · Wei Liu
Quoted 17 lines · Jan Beulich
Quoted 17 lines
Quoted 1 line
Quoted 1 line · On 27.05.16 at 17:31, <[email protected]> wrote:
Quoted 15 lines · Wei Liu
Quoted 14 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 27.05.16 at 15:30, <[email protected]> wrote:
Commit 26646f3 "x86/mce: translate passed-in GPA to host machine address" and commit 4ddf474 "
tools/xen-mceinj: Pass in GPA when injecting throughMSR_MCI_ADDR" forgot to consider reserved domain ID and mistakenly addMC_MSRINJ_F_GPADDRflag 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_GPADDRflag and checks this when injecting to reserved domain IDs exceptDOMID_SELF, and treats the passed-in address as host machine address.Signed-off-by Haozhong Zhang <[email protected]>Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Reviewed-by Jan Beulich <[email protected]>Release-acked-by Wei Liu <[email protected]>And queued.
Please wait for a maintainer ack.
Quoted 7 lines
$ ./scripts/get_maintainer.pl -f xen/arch/x86/cpu/mcheck/mce.c Christoph Egger <[email protected]> Liu Jinsong <[email protected]> Jan Beulich <[email protected]> Andrew Cooper <[email protected]> [email protected]OK, so looking at
MAINTAINERSfile:MACHINE CHECK (MCA) & RAS
Quoted 8 lines
M: Christoph Egger <[email protected]> M: Liu Jinsong <[email protected]> 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
[email protected]
http://lists.xen.org/xen-devel
Quoted 46 lines · Haozhong Zhang
Quoted 45 lines · Wei Liu
Quoted 28 lines · Wei Liu
Quoted 17 lines · Jan Beulich
Quoted 17 lines
Quoted 1 line
Quoted 1 line · On 27.05.16 at 17:31, <[email protected]> wrote:
Quoted 15 lines · Wei Liu
Quoted 14 lines · Jan Beulich
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 27.05.16 at 15:30, <[email protected]> wrote:
Commit 26646f3 "x86/mce: translate passed-in GPA to host machine address" and commit 4ddf474 "
tools/xen-mceinj: Pass in GPA when injecting throughMSR_MCI_ADDR" forgot to consider reserved domain ID and mistakenly addMC_MSRINJ_F_GPADDRflag 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_GPADDRflag and checks this when injecting to reserved domain IDs exceptDOMID_SELF, and treats the passed-in address as host machine address.Signed-off-by Haozhong Zhang <[email protected]>Quoted 9 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Reviewed-by Jan Beulich <[email protected]>Release-acked-by Wei Liu <[email protected]>And queued.
Please wait for a maintainer ack.
Quoted 7 lines
$ ./scripts/get_maintainer.pl -f xen/arch/x86/cpu/mcheck/mce.c Christoph Egger <[email protected]> Liu Jinsong <[email protected]> Jan Beulich <[email protected]> Andrew Cooper <[email protected]> [email protected]OK, so looking at
MAINTAINERSfile:MACHINE CHECK (MCA) & RAS
M: Christoph Egger <[email protected]> M: Liu Jinsong <[email protected]> S: Supported F: xen/arch/x86/cpu/mcheck/
Quoted 8 lines
Quoted 3 lines
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.
Quoted 2 lines
Thanks,
Haozhong
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 7 lines · Haozhong Zhang
Commit 26646f3 "x86/mce: translate passed-in GPA to host machine address" and commit 4ddf474 "
tools/xen-mceinj: Pass in GPA when injecting throughMSR_MCI_ADDR" forgot to consider reserved domain ID and mistakenly addMC_MSRINJ_F_GPADDRflag for them, which in turn causes bug reported by
http://lists.xenproject.org/archives/html/xen-devel/2016-05/msg02640.html.
Quoted 5 lines
This patch removes
MC_MSRINK_F_GPADDRflag and checks this when injecting to reserved domain IDs exceptDOMID_SELF, and treats the passed-in address as host machine address.Signed-off-by Haozhong Zhang <[email protected]>
Quoted 64 lines
---
Changes in v3:
* Refine check condition of domid.Changes in v2:
* Consider all reserved domain IDs rather than justDOMID_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(-)tools/tests/mce-test/tools/xen-mceinj.c +4
-1@@ -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); }xen/arch/x86/cpu/mcheck/mce.c +10
-2@@ -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;
xen/arch/x86/cpu/mcheck/mce.c long do_mca(XEN_GUEST_HANDLE_PARAM(xen_mc_t) u_xen_mc) · line 1466
Quoted 8 lines
xen/arch/x86/cpu/mcheck/mce.c +1
-1@@ -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
[email protected]
http://lists.xen.org/xen-devel
Quoted 8 lines · Christoph
Quoted 7 lines · Haozhong Zhang
Commit 26646f3 "x86/mce: translate passed-in GPA to host machine address" and commit 4ddf474 "
tools/xen-mceinj: Pass in GPA when injecting throughMSR_MCI_ADDR" forgot to consider reserved domain ID and mistakenly addMC_MSRINJ_F_GPADDRflag for them, which in turn causes bug reported by
http://lists.xenproject.org/archives/html/xen-devel/2016-05/msg02640.html.
Quoted 8 lines
Quoted 5 lines
This patch removes
MC_MSRINK_F_GPADDRflag and checks this when injecting to reserved domain IDs exceptDOMID_SELF, and treats the passed-in address as host machine address.Signed-off-by Haozhong Zhang <[email protected]>Acked-by Christoph Egger <[email protected]>
Thanks! I will see what I can with it for 4.7.0.
Wei.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel