* [PATCH] x86/domctl: don't ignore errors from vmce_restore_vcpu()
@ 2014-01-29 15:57 Jan Beulich
2014-01-29 16:34 ` Andrew Cooper
0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2014-01-29 15:57 UTC (permalink / raw)
To: xen-devel; +Cc: George Dunlap, Keir Fraser
[-- Attachment #1: Type: text/plain, Size: 2991 bytes --]
What started out as a simple cleanup patch (eliminating the redundant
check of domctl->cmd before setting "copyback", which as a result
turned the "ext_vcpucontext_out" label useless) revealed a bug in the
handling of XEN_DOMCTL_set_ext_vcpucontext.
Fix this, retaining the cleanup, and at once dropping a stale comment
and an accompanying formatting issue.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -815,7 +815,7 @@ long arch_do_domctl(
ret = -ESRCH;
if ( (evc->vcpu >= d->max_vcpus) ||
((v = d->vcpu[evc->vcpu]) == NULL) )
- goto ext_vcpucontext_out;
+ break;
if ( domctl->cmd == XEN_DOMCTL_get_ext_vcpucontext )
{
@@ -847,17 +847,20 @@ long arch_do_domctl(
evc->vmce.caps = v->arch.vmce.mcg_cap;
evc->vmce.mci_ctl2_bank0 = v->arch.vmce.bank[0].mci_ctl2;
evc->vmce.mci_ctl2_bank1 = v->arch.vmce.bank[1].mci_ctl2;
+
+ ret = 0;
+ copyback = 1;
}
else
{
ret = -EINVAL;
if ( evc->size < offsetof(typeof(*evc), vmce) )
- goto ext_vcpucontext_out;
+ break;
if ( is_pv_domain(d) )
{
if ( !is_canonical_address(evc->sysenter_callback_eip) ||
!is_canonical_address(evc->syscall32_callback_eip) )
- goto ext_vcpucontext_out;
+ break;
fixup_guest_code_selector(d, evc->sysenter_callback_cs);
v->arch.pv_vcpu.sysenter_callback_cs =
evc->sysenter_callback_cs;
@@ -873,13 +876,11 @@ long arch_do_domctl(
v->arch.pv_vcpu.syscall32_disables_events =
evc->syscall32_disables_events;
}
- else
- /* We do not support syscall/syscall32/sysenter on 32-bit Xen. */
- if ( (evc->sysenter_callback_cs & ~3) ||
- evc->sysenter_callback_eip ||
- (evc->syscall32_callback_cs & ~3) ||
- evc->syscall32_callback_eip )
- goto ext_vcpucontext_out;
+ else if ( (evc->sysenter_callback_cs & ~3) ||
+ evc->sysenter_callback_eip ||
+ (evc->syscall32_callback_cs & ~3) ||
+ evc->syscall32_callback_eip )
+ break;
BUILD_BUG_ON(offsetof(struct xen_domctl_ext_vcpucontext,
mcg_cap) !=
@@ -896,13 +897,9 @@ long arch_do_domctl(
ret = vmce_restore_vcpu(v, &vmce);
}
+ else
+ ret = 0;
}
-
- ret = 0;
-
- ext_vcpucontext_out:
- if ( domctl->cmd == XEN_DOMCTL_get_ext_vcpucontext )
- copyback = 1;
}
break;
[-- Attachment #2: x86-domctl-evc-cleanup.patch --]
[-- Type: text/plain, Size: 3045 bytes --]
x86/domctl: don't ignore errors from vmce_restore_vcpu()
What started out as a simple cleanup patch (eliminating the redundant
check of domctl->cmd before setting "copyback", which as a result
turned the "ext_vcpucontext_out" label useless) revealed a bug in the
handling of XEN_DOMCTL_set_ext_vcpucontext.
Fix this, retaining the cleanup, and at once dropping a stale comment
and an accompanying formatting issue.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/domctl.c
+++ b/xen/arch/x86/domctl.c
@@ -815,7 +815,7 @@ long arch_do_domctl(
ret = -ESRCH;
if ( (evc->vcpu >= d->max_vcpus) ||
((v = d->vcpu[evc->vcpu]) == NULL) )
- goto ext_vcpucontext_out;
+ break;
if ( domctl->cmd == XEN_DOMCTL_get_ext_vcpucontext )
{
@@ -847,17 +847,20 @@ long arch_do_domctl(
evc->vmce.caps = v->arch.vmce.mcg_cap;
evc->vmce.mci_ctl2_bank0 = v->arch.vmce.bank[0].mci_ctl2;
evc->vmce.mci_ctl2_bank1 = v->arch.vmce.bank[1].mci_ctl2;
+
+ ret = 0;
+ copyback = 1;
}
else
{
ret = -EINVAL;
if ( evc->size < offsetof(typeof(*evc), vmce) )
- goto ext_vcpucontext_out;
+ break;
if ( is_pv_domain(d) )
{
if ( !is_canonical_address(evc->sysenter_callback_eip) ||
!is_canonical_address(evc->syscall32_callback_eip) )
- goto ext_vcpucontext_out;
+ break;
fixup_guest_code_selector(d, evc->sysenter_callback_cs);
v->arch.pv_vcpu.sysenter_callback_cs =
evc->sysenter_callback_cs;
@@ -873,13 +876,11 @@ long arch_do_domctl(
v->arch.pv_vcpu.syscall32_disables_events =
evc->syscall32_disables_events;
}
- else
- /* We do not support syscall/syscall32/sysenter on 32-bit Xen. */
- if ( (evc->sysenter_callback_cs & ~3) ||
- evc->sysenter_callback_eip ||
- (evc->syscall32_callback_cs & ~3) ||
- evc->syscall32_callback_eip )
- goto ext_vcpucontext_out;
+ else if ( (evc->sysenter_callback_cs & ~3) ||
+ evc->sysenter_callback_eip ||
+ (evc->syscall32_callback_cs & ~3) ||
+ evc->syscall32_callback_eip )
+ break;
BUILD_BUG_ON(offsetof(struct xen_domctl_ext_vcpucontext,
mcg_cap) !=
@@ -896,13 +897,9 @@ long arch_do_domctl(
ret = vmce_restore_vcpu(v, &vmce);
}
+ else
+ ret = 0;
}
-
- ret = 0;
-
- ext_vcpucontext_out:
- if ( domctl->cmd == XEN_DOMCTL_get_ext_vcpucontext )
- copyback = 1;
}
break;
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] x86/domctl: don't ignore errors from vmce_restore_vcpu()
2014-01-29 15:57 [PATCH] x86/domctl: don't ignore errors from vmce_restore_vcpu() Jan Beulich
@ 2014-01-29 16:34 ` Andrew Cooper
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cooper @ 2014-01-29 16:34 UTC (permalink / raw)
To: Jan Beulich; +Cc: George Dunlap, xen-devel, Keir Fraser
[-- Attachment #1.1: Type: text/plain, Size: 3301 bytes --]
On 29/01/14 15:57, Jan Beulich wrote:
> What started out as a simple cleanup patch (eliminating the redundant
> check of domctl->cmd before setting "copyback", which as a result
> turned the "ext_vcpucontext_out" label useless) revealed a bug in the
> handling of XEN_DOMCTL_set_ext_vcpucontext.
>
> Fix this, retaining the cleanup, and at once dropping a stale comment
> and an accompanying formatting issue.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
>
> --- a/xen/arch/x86/domctl.c
> +++ b/xen/arch/x86/domctl.c
> @@ -815,7 +815,7 @@ long arch_do_domctl(
> ret = -ESRCH;
> if ( (evc->vcpu >= d->max_vcpus) ||
> ((v = d->vcpu[evc->vcpu]) == NULL) )
> - goto ext_vcpucontext_out;
> + break;
>
> if ( domctl->cmd == XEN_DOMCTL_get_ext_vcpucontext )
> {
> @@ -847,17 +847,20 @@ long arch_do_domctl(
> evc->vmce.caps = v->arch.vmce.mcg_cap;
> evc->vmce.mci_ctl2_bank0 = v->arch.vmce.bank[0].mci_ctl2;
> evc->vmce.mci_ctl2_bank1 = v->arch.vmce.bank[1].mci_ctl2;
> +
> + ret = 0;
> + copyback = 1;
> }
> else
> {
> ret = -EINVAL;
> if ( evc->size < offsetof(typeof(*evc), vmce) )
> - goto ext_vcpucontext_out;
> + break;
> if ( is_pv_domain(d) )
> {
> if ( !is_canonical_address(evc->sysenter_callback_eip) ||
> !is_canonical_address(evc->syscall32_callback_eip) )
> - goto ext_vcpucontext_out;
> + break;
> fixup_guest_code_selector(d, evc->sysenter_callback_cs);
> v->arch.pv_vcpu.sysenter_callback_cs =
> evc->sysenter_callback_cs;
> @@ -873,13 +876,11 @@ long arch_do_domctl(
> v->arch.pv_vcpu.syscall32_disables_events =
> evc->syscall32_disables_events;
> }
> - else
> - /* We do not support syscall/syscall32/sysenter on 32-bit Xen. */
> - if ( (evc->sysenter_callback_cs & ~3) ||
> - evc->sysenter_callback_eip ||
> - (evc->syscall32_callback_cs & ~3) ||
> - evc->syscall32_callback_eip )
> - goto ext_vcpucontext_out;
> + else if ( (evc->sysenter_callback_cs & ~3) ||
> + evc->sysenter_callback_eip ||
> + (evc->syscall32_callback_cs & ~3) ||
> + evc->syscall32_callback_eip )
> + break;
>
> BUILD_BUG_ON(offsetof(struct xen_domctl_ext_vcpucontext,
> mcg_cap) !=
> @@ -896,13 +897,9 @@ long arch_do_domctl(
>
> ret = vmce_restore_vcpu(v, &vmce);
> }
> + else
> + ret = 0;
> }
> -
> - ret = 0;
> -
> - ext_vcpucontext_out:
> - if ( domctl->cmd == XEN_DOMCTL_get_ext_vcpucontext )
> - copyback = 1;
> }
> break;
>
>
>
>
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel
[-- Attachment #1.2: Type: text/html, Size: 4181 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-01-29 16:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-29 15:57 [PATCH] x86/domctl: don't ignore errors from vmce_restore_vcpu() Jan Beulich
2014-01-29 16:34 ` Andrew Cooper
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).