[xen master] xen/pv: Construct d0v0's GDT properly

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen master] xen/pv: Construct d0v0's GDT properly

patchbot
commit 08f27f4468eedbeccaac9fdda4ef732247efd74e
Author:     Andrew Cooper <[hidden email]>
AuthorDate: Mon Oct 16 13:20:07 2017 +0000
Commit:     Andrew Cooper <[hidden email]>
CommitDate: Fri Dec 1 19:03:26 2017 +0000

    xen/pv: Construct d0v0's GDT properly
   
    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 <[hidden email]>
    Reviewed-by: Jan Beulich <[hidden email]>
    ---
    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 44601d0..a13412e 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>
 
 /* Allow ring-3 access in long mode as guest cannot use ring 1 ... */
@@ -866,6 +867,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");
 
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog