* [PATCH for-next] xen/pv: Construct d0v0's GDT properly
@ 2017-10-16 14:38 Andrew Cooper
2017-10-16 15:58 ` Jan Beulich
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Cooper @ 2017-10-16 14:38 UTC (permalink / raw)
To: Xen-devel; +Cc: Andrew Cooper, Jan Beulich
c/s cf6d39f8199 "x86/PV: properly populate descriptor tables" changed the GDT
to reference zero_page for intermediate frames between the guest and Xen
frames.
Because dom0_construct_pv() doesn't call arch_set_info_guest(), some bits of
initialisation are missed, including the pv_destroy_gdt() which initially
fills the references to zero_page.
In practice, this means there is a window between starting and the first call
to HYPERCALL_set_gdt() were lar/lsl/verr/verw suffer non-architectural
behaviour.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
This probably wants backporting to Xen 4.7 and later.
---
xen/arch/x86/pv/dom0_build.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/xen/arch/x86/pv/dom0_build.c b/xen/arch/x86/pv/dom0_build.c
index 8ad7e3d..984a94a 100644
--- a/xen/arch/x86/pv/dom0_build.c
+++ b/xen/arch/x86/pv/dom0_build.c
@@ -18,6 +18,7 @@
#include <asm/bzimage.h>
#include <asm/dom0_build.h>
#include <asm/page.h>
+#include <asm/pv/mm.h>
#include <asm/setup.h>
#include "mm.h"
@@ -867,6 +868,13 @@ int __init dom0_construct_pv(struct domain *d,
regs->rsi = vstartinfo_start;
regs->eflags = X86_EFLAGS_IF;
+ /*
+ * We don't call arch_set_info_guest(), so some initialisation needs doing
+ * by hand:
+ * - Reset the GDT to reference zero_page
+ */
+ pv_destroy_gdt(v);
+
if ( test_bit(XENFEAT_supervisor_mode_kernel, parms.f_required) )
panic("Dom0 requires supervisor-mode execution");
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH for-next] xen/pv: Construct d0v0's GDT properly
2017-10-16 14:38 [PATCH for-next] xen/pv: Construct d0v0's GDT properly Andrew Cooper
@ 2017-10-16 15:58 ` Jan Beulich
2017-10-16 17:03 ` Andrew Cooper
0 siblings, 1 reply; 3+ messages in thread
From: Jan Beulich @ 2017-10-16 15:58 UTC (permalink / raw)
To: Andrew Cooper; +Cc: Xen-devel
>>> On 16.10.17 at 16:38, <andrew.cooper3@citrix.com> wrote:
> c/s cf6d39f8199 "x86/PV: properly populate descriptor tables" changed the GDT
> to reference zero_page for intermediate frames between the guest and Xen
> frames.
>
> Because dom0_construct_pv() doesn't call arch_set_info_guest(), some bits of
> initialisation are missed, including the pv_destroy_gdt() which initially
> fills the references to zero_page.
>
> In practice, this means there is a window between starting and the first call
> to HYPERCALL_set_gdt() were lar/lsl/verr/verw suffer non-architectural
> behaviour.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
> This probably wants backporting to Xen 4.7 and later.
Could you remind me once the patch has gone in (as that'll be only
in quite a few weeks)?
Thanks, Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH for-next] xen/pv: Construct d0v0's GDT properly
2017-10-16 15:58 ` Jan Beulich
@ 2017-10-16 17:03 ` Andrew Cooper
0 siblings, 0 replies; 3+ messages in thread
From: Andrew Cooper @ 2017-10-16 17:03 UTC (permalink / raw)
To: Jan Beulich; +Cc: Xen-devel
On 16/10/17 16:58, Jan Beulich wrote:
>>>> On 16.10.17 at 16:38, <andrew.cooper3@citrix.com> wrote:
>> c/s cf6d39f8199 "x86/PV: properly populate descriptor tables" changed the GDT
>> to reference zero_page for intermediate frames between the guest and Xen
>> frames.
>>
>> Because dom0_construct_pv() doesn't call arch_set_info_guest(), some bits of
>> initialisation are missed, including the pv_destroy_gdt() which initially
>> fills the references to zero_page.
>>
>> In practice, this means there is a window between starting and the first call
>> to HYPERCALL_set_gdt() were lar/lsl/verr/verw suffer non-architectural
>> behaviour.
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
>
>> This probably wants backporting to Xen 4.7 and later.
> Could you remind me once the patch has gone in (as that'll be only
> in quite a few weeks)?
I will stick this in my x86-next branch, and leave myself a note. (I
guess we will see how well this scheme works.)
~Andrew
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-10-16 17:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-16 14:38 [PATCH for-next] xen/pv: Construct d0v0's GDT properly Andrew Cooper
2017-10-16 15:58 ` Jan Beulich
2017-10-16 17:03 ` Andrew Cooper
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.